Is there any way to access a column in datum using its positional index such as datum[1] (doesn't work) instead of datum.ColumnName or datum['ColumnName']?
Asked
Active
Viewed 54 times
0
-
No. What are you trying to do as there may be an alternative. All the columns provided by PBI to Deneb are named anyway. – Davide Bacci Feb 16 '23 at 18:45
-
It could be a simpler workaround to the issue where a Field Parameter sends into Deneb different columns depending on the selection in its slicer. With datum[1] it would be just one-line transform in Vega Lite. The workaround that I use now calls isDefined(datum['ColumnName']) for checking whether a ColumnName exists for every column included into a Field Parameter and uses if/then/else for creating a resulting column with predefined name. – VladB Feb 16 '23 at 19:06
-
I see. I suspect PBI doesn't guarantee column order to custom visuals anyway. – Davide Bacci Feb 16 '23 at 19:15
-
From what I've seen so far, they are coming into Deneb in the same order as listed in the Values box. Calculated columns (results of the transforms or in-encoding aggregation) are added to the right. Did you see them out of that order? – VladB Feb 16 '23 at 21:39
-
No but there is probably no guarantee in the API that Deneb is using. – Davide Bacci Feb 16 '23 at 22:08