cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
adityapv
Helper II
Helper II

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

@adityapv , 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/50...



Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Learn Power BI P&L Statement || Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s ||
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!!! How to get Quick Help !!
Resources | Master Power BI !! Expertise Power BI !! Power BI For Tableau User !!

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@adityapv , 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/50...



Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Learn Power BI P&L Statement || Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s ||
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!!! How to get Quick Help !!
Resources | Master Power BI !! Expertise Power BI !! Power BI For Tableau User !!

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

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 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.