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
Kyne33
Frequent Visitor

IF or SWITCH statement to select two measures in DAX

Hi All,

 

I have been working on creating a financial dashboard to look into revenues, cos, overheads and net profits all as This Year, Last Year and Budget for this year comparrisons.

 

Instead of having a 100 graphs and pages to go through and look for specific line items, I have been trying to create a single graph which will display the three measures of last year, this year and budget when a line item is selected such as Domestic Revenue or Express Revenue from a seperate slicer table.

 

This seperate slicer table is created with no relationships and purely acting as a selection table for the user.

 

I have tried to use the following SWITCH formula,

Revenues = SWITCH(TRUE(),

VALUES('Revenue Measures Actual'[Actual Year Revenues]) = "Domestic Revenue" , [Domestic Revenue This Year],

VALUES('Revenue Measures Actual'[Actual Year Revenues]) = "Domestic Revenue" , [Domestic Revenue Last Year] ,

VALUES('Revenue Measures Actual'[Actual Year Revenues]) = "Domestic Revenue" , [Domestic Revenue Budget] ,

BLANK())

 

 What is currently happening when Domestic Revenue is selected, only the one measure being Domestic Revenue This Year is being displayed in the graph, where as all 3 being measures is 1st prize!

 

Perhaps an amendment to the SWITCH formula or multiple IF formula would work?

 

Please let me know your thoughts!

Many Thanks.

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Kyne33,

 

You'll need to write three measures, not just one.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft,

 

I have three measures, being Domestic Revenue This Year, Domestic Revenue Last Year and Domestic Revenue Budget. With only one measure being Domestic Revenue This year being displayed when Domestic Revenue in the slicer is selected.

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.