Forum Discussion
jjr333
7 years agoAdvocate I
Dynamic Column calculation based on Slicer Selection
Is it possible to select a column dynamically, based on selection of a slicer item?
The slicer contains the column names.
I am trying to avoid having to write a number of similar Measures using SWITCH.
Code below does not work.
Cheers, J.
Dynamic Count = VAR varSelectedItem = [ItemSelection] // value from slicer with column names
VAR varCountColumn = "factSanSeb[" & varSelectedItem & "]"
RETURN COUNTA(varCountColumn)Hello Pavan,
The solution below works. But I am trying to avoid having to write many Measures.
AVE Readings = IF(HASONEVALUE(MeasuredValues[Measure]); SWITCH(SELECTEDVALUE(MeasuredValues[Measure]); "NO";[NO Ave]; "SO2";[SO2 Ave]; "NO2";[NO2 Ave]; "O3";[O3 Ave]; "PM10";[PM10 Ave]; "PM2,5";[PM2,5 Ave]; "Precip.";[Precip. Ave]; "Other" ); BLANK())
2 Replies
- AnonymousNot applicable
- jjr333Advocate I
Hello Pavan,
The solution below works. But I am trying to avoid having to write many Measures.
AVE Readings = IF(HASONEVALUE(MeasuredValues[Measure]); SWITCH(SELECTEDVALUE(MeasuredValues[Measure]); "NO";[NO Ave]; "SO2";[SO2 Ave]; "NO2";[NO2 Ave]; "O3";[O3 Ave]; "PM10";[PM10 Ave]; "PM2,5";[PM2,5 Ave]; "Precip.";[Precip. Ave]; "Other" ); BLANK())