Forum Discussion
2 switch statements withing Calculation item (Calculation Groups)
Hello,
I am trying to achieve the below table with calculation items. And the below DAX will return the variable result instead of the return value. For the Actual values I have the correct numbers and separate calculation item which works fine, but for Prior Period item it return the Actual values.
Table
Measure | Actual | Prior Period
Prior Period =
VAR Actual =
SWITCH (
SELECTEDVALUE ( 'MTD_YTD'[Num] );
1; SELECTEDMEASURE ();
2; CALCULATE (
SELECTEDMEASURE ();
FILTER ( 'Date_Dim'; DAY ( 'Date_Dim'[Date] ) < DAY ( TODAY () ) + 1 )
);
3; CALCULATE ( SELECTEDMEASURE (); DATESYTD ( 'Date_Dim'[Date] ) )
)
RETURN
SWITCH (
SELECTEDVALUE ( 'Prior Per'[Num] );
2; CALCULATE ( actual; PREVIOUSMONTH ( 'Date_Dim'[Date] ) );
3; CALCULATE ( actual; SAMEPERIODLASTYEAR ( 'Date_Dim'[Date] ) )
)
1 Reply
- Icey
Community Support
Hi Anonymous ,
Please share me a dummy PBIX file without real data or sensitive information. Then I can carry out specific tests.
Best Regards,
Icey