Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

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 1
Icey
Community Support
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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.