Forum Discussion

cristianml's avatar
cristianml
Post Prodigy
4 years ago
Solved

Return a column from selected value

Hi,

I need help with the following measure.  I want to return a column depending of the selected value that could be "MTD", "QTD" or "YTD". 

 

SELECTED MTD-QTD-YTD =
VAR _1 = SELECTEDVALUE ( '01_Period'[Period] )

RETURN

SWITCH (
TRUE () ,
_1 = "MTD" ,SELECTEDVALUE('00_CALENDAR'[Month & FY]),
_1 = "QTD" ,MAX('00_CALENDAR'[Current QTD]) ,
_1 = "YTD" ,MAX('00_CALENDAR'[FY & Q]) ,
"NADA")
 

 

 

This works only if I use MAX but it gives me the last value of that column and I need to return ALL the values from the column or the selected ones. I tried using "Selectedvalue" in the first var but also doesn't work.

 

Hope you can help me to correct this measure so it works.
Thanks!
  • A measure can only return a single scalar value, it can't return a column of values.

    If the larger problem that you're trying to solve is that you want the user to be able to choose which version of a measure appears in a report, you should look into calculation groups.

1 Reply

  • A measure can only return a single scalar value, it can't return a column of values.

    If the larger problem that you're trying to solve is that you want the user to be able to choose which version of a measure appears in a report, you should look into calculation groups.