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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Show multiple measures based on single slicer selection in power bi

Hi,I have created 4 measures 

1.sales A

2.sales B

3.Profit A

4.Profit B

Now i need to display these  measures in line graph.

Requirement:Slicer contains two fields 1.Sales 2.Profit

1.when i select Sales in slicer i need to display sales A and Sales B measures in line graph

2.when i select Profit in slicer i need to display Profit A and Profit B measures in line graph.

 

tried with switch condition but its not working please help me with this scenario

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , You need to create two measures

 

A = Switch(SELECTEDVALUE(Slicer[Slicer]) ,

"Sales", [Sales A] ,

"Profit", [Profit A]

)

 

 

 

B= Switch(SELECTEDVALUE(Slicer[Slicer]) ,

"Sales", [Sales B] ,

"Profit", [Profit B]

)

 

 

use both in a visual

 

 

refer if needed

measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You need to create two measures

 

A = Switch(SELECTEDVALUE(Slicer[Slicer]) ,

"Sales", [Sales A] ,

"Profit", [Profit A]

)

 

 

 

B= Switch(SELECTEDVALUE(Slicer[Slicer]) ,

"Sales", [Sales B] ,

"Profit", [Profit B]

)

 

 

use both in a visual

 

 

refer if needed

measure slicer
https://www.youtube.com/watch?v=b9352Vxuj-M
https://community.powerbi.com/t5/Desktop/Slicer-MTD-QTD-YTD-to-filter-dates-using-the-slicer/td-p/500115

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi amit,thank you so much.your solution is working.

Anonymous
Not applicable

Spoiler
Hi,
Thanks for response.but my requirement is different.
Slicer having 1.sales 2.profit
If I select sales then I need to display sales A and sales B
If I select profit then I need to display profit A and profit B.please help me with this scenario

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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