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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Marjss
Frequent Visitor

SWITCH function and time intelligence

Hi! I was hoping you guys could help me with this...

I'm building a KPI Dashboard, and I need to create a button (with the SWITCH function, i'm guessing), that changes the values between Current Month x YTD x Last Year on Budget and Actual on the charts.

I've tried inumerous ways of doing it, but my problem always seems to be that the selector won't work! It just gives me the same number, wether I select YTD, Actual or Last Year.

I have also tried searching for this on this forum, but I can't seem to find anything!

 

The measures I'm using:

 

Actual = CALCULATE([SumAmount2];Scenario[ScenarioName]="Actual")
ActualQTD = CALCULATE([Actual]; DATESQTD(Calendar[Date]))
ActualYTD = CALCULATE([Actual]; DATESYTD(Calendar[Date]))

same for budget.

 

And the switch function:

Actual Select = SWITCH([SelectorNum] ; 1; [Actual] ; 2; [ActualQTD] ; 3; [ActualYTD] ) This selector Num is a measure: SelectorNum = MIN(SelectMeasure[SelectorNumber])

 

The Selector Number is a standart table to use for SWITCH functions, which includes:

 

Selector        Selector Number

Current                 1

QTD                      2

YTD                       3

 

Any help will be much aprreciated!! I have been struggling with this issue for a while now, and no one in my company knows anything about Power BI. Thank you!

2 REPLIES 2
MFelix
Super User
Super User

Hi @Marjss,

 

Change you measure for YTD and QTD to:

 

Actual = CALCULATE([SumAmount2];Scenario[ScenarioName]="Actual")
ActualQTD = CALCULATE ( TOTALQTD ( [Actual], Calendar[Date] ) )
ActualYTD = CALCULATE ( TOTALYTD ( [Actual], Calendar[Date] ) )

Should work,

 

Regards,

MFelix

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Marjss
Frequent Visitor

Hi!

 

I was hoping you guys could help me with this...

I'm building a KPI Dashboard, and I need to create a button (with the SWITCH function, i'm guessing), that changes the values between Current Month x YTD x Last Year on Budget and Actual charts.

I have been struggling with this issue for a while now, and no one in my company knows anything about Power BI. 

 

I've tried inumerous ways of doing it, but my problem always seems to be that the selector won't work! 

 

It just gives me the same number, wether I select YTD, Actual or Last Year. 

 

I have also tried searching for this on this forum, but I can't seem to find anything! 

 

 

The measures I'm using:


Actual = CALCULATE([SumAmount2];Scenario[ScenarioName]="Actual")
ActualQTD = CALCULATE([Actual]; DATESQTD(Calendar[Date]))

ActualYTD = CALCULATE([Actual]; DATESYTD(Calendar[Date]))

same for budget.

And the switch function:
Actual Select = SWITCH([SelectorNum]
; 1; [Actual]
; 2; [ActualQTD]
; 3; [ActualYTD]
)

 

This selector Num is a measure:

 

SelectorNum = MIN(SelectMeasure[SelectorNumber])

The Selector Number is a standart table to use for SWITCH functions, which includes:

Selector     Selector Number

Current           1

QTD                2

YTD                3

 

 

 

Any help would be much aprreciated!!

 

Thank you

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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