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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors