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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Dynamic grand total problem depending on switch selection

Hello community,
I'm unsuccessfully trying to show the dynamic Grand Total as the sum of the columns depending on whether or not I select the "Scenario" filter to show more measures.
If I select one measure the total appears

FEST__4-1678475956528.png

but if I select two or more selections it does not appear

FEST__5-1678476068197.png

The reason is that the measures do not talk to each other using the "Scenario" selector which is detached from the model and is used within the measures via the SWITCH function. 
I insert the measure, for simplicity I remove some scenarios
Sum_Scenario_Year = 

//example of recalled measures
//ACT CY = CALCULATE(SUM('CAPEX FOR ENG'[SCENARIO_VALUE]),'CAPEX FOR ENG'[SCENARIO] = "ACT" , DATESYTD(TIME[Date]))
// ACT - 1 = CALCULATE(SUM('CAPEX FOR ENG'[SCENARIO_VALUE]),'CAPEX FOR ENG'[SCENARIO] = "ACT" , DATEADD(DATESYTD(TIME[Date]), -1, YEAR))
// PCL CY = CALCULATE(SUM('CAPEX FOR ENG'[SCENARIO_VALUE]),'CAPEX FOR ENG'[SCENARIO] = "PCL" , DATESYTD(TIME[Date]))

VAR Scenario_value =SWITCH(SELECTEDVALUE('MAIN BASELINE'[MAIN BASELINE]),
                "ACT CY" , [ACT CY],
                "ACT -1",  [ACT -1],
                "PCL CY" , [PCL CY],
             )
RETURN
Scenario_value

I tried to insert a logic for the total but it takes the sum of all the measures without distinction from the selected ones

FEST__6-1678476538035.png

//if (hasonevalue('MAIN BASELINE'[MAIN BASELINE]),Scenario_value ,  [ACT CY]+[ACT -1]+[ACT -2]+[ACT -3]+[FCT CY]+[BDG CY]+[PCL CY]+[EST CY]+[CMT CY]+[FTR + 1]+[FTR + 2]+[FTR + 3]+[FTR + 4]+[FTR + 5])
The model involved is this one

FEST__8-1678477054356.png

I am not sure if this is possible, but any help regarding this issue is greatly appreciated! Thank you in advance!
FEST

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 

please try

Sum_Scenario_Year =
SUMX (
VALUES ( 'MAIN BASELINE'[MAIN BASELINE] ),
SWITCH (
'MAIN BASELINE'[MAIN BASELINE],
"ACT CY", [ACT CY],
"ACT -1", [ACT -1],
"PCL CY", [PCL CY]
)
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @Anonymous 

please try

Sum_Scenario_Year =
SUMX (
VALUES ( 'MAIN BASELINE'[MAIN BASELINE] ),
SWITCH (
'MAIN BASELINE'[MAIN BASELINE],
"ACT CY", [ACT CY],
"ACT -1", [ACT -1],
"PCL CY", [PCL CY]
)
)

Anonymous
Not applicable

Hi @tamerj1 , 

It works!!! 🙂

Thank you very much for both resolution suggestions
FEST__0-1678543174796.png

FEST

Anonymous
Not applicable

HI @amitchandak , 

I tried as you indicated but I still don't see the total when I have two scenarios 😞

FEST__1-1678539449460.png

 

FEST

amitchandak
Super User
Super User

@Anonymous , Change return like

Sumx( values('MAIN BASELINE'[MAIN BASELINE]), Scenario_value)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.