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
Anonymous
Not applicable

Creating multi select slicer measure for a dynamic line chart

Hi all, I have been successfully been able to make a dynamically customizable dual y-axis line chart using measures and slicing it. But, I want to hear if it can be taken to the next level and using the slicers to make multi select, and hence get multiple lines rather than the current limit of 2 selections. 

 

Current setup is using SWITCH and a manually entered table to direct to the data source.

 

This is where I am at - 

Screenshot 2019-05-09 11.00.28.png

 

 

Any way to upgrade on the current DAX query to get to a multi select dual axis line chart? 

 

Capture.PNG

Thanks, Ziyad 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

You could try this way as below:

For all your basic measure add a if conditional like below:

 

Measure 1 = IF("A" IN VALUES('Y axis 1'[Measurement 1]), CALCULATE(SUM(Table1[Index])))
Measure 2 = IF("B" IN VALUES('Y axis 1'[Measurement 1]),CALCULATE(SUM(Table1[Sales])))
Measure 3 = IF("C" IN VALUES('Y axis 1'[Measurement 1]), CALCULATE(SUM(Table1[Sales]),ALL(Table1)))

Then drag all these measrue into line Values.

Result:

3.JPG4.JPG5.JPG

 

You could use the same logic for 'Y axis 2',

Here is sample pbix file, please try it.

 

 

Best Regards,

Lin

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Similar to the above use case for adding dynamic measure for a line chart, how do I create a measure to select columns dynamically based on the selection I make in the measure.

For Eg: I have three measures A,B,C. Upon selecting A,B -> I get a table like below

ContentAB
   

 

Just selecting B: 

ContentB
  

 

Selecting B,C

ContentBC
   

 

and so on..

v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

You could try this way as below:

For all your basic measure add a if conditional like below:

 

Measure 1 = IF("A" IN VALUES('Y axis 1'[Measurement 1]), CALCULATE(SUM(Table1[Index])))
Measure 2 = IF("B" IN VALUES('Y axis 1'[Measurement 1]),CALCULATE(SUM(Table1[Sales])))
Measure 3 = IF("C" IN VALUES('Y axis 1'[Measurement 1]), CALCULATE(SUM(Table1[Sales]),ALL(Table1)))

Then drag all these measrue into line Values.

Result:

3.JPG4.JPG5.JPG

 

You could use the same logic for 'Y axis 2',

Here is sample pbix file, please try it.

 

 

Best Regards,

Lin

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

How would you show only selected slicer value on legend? any idea?

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.