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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Kalaivani
Helper II
Helper II

How to create a visualization based on selected measures in slicer

I have a Category Table for Measure which lists all measure names that I am going to use in the dashboard. 

 

I have a matrix visual that shows the the measure category, year-month and corresponding values for each year-month for each measure.

 

I wanted to know if I will be able to create a visual - let's say a line or combo visual to show the selected measures(more than 1 measure). Let's say I select Wrvus and Wrvus/Visit in measures filter below, then the primary axis can be wrvus and secondary axis can be wrvus per visit. Max of 2 measures will only be selected.

Kalaivani_0-1738203729577.png

I was able to do it on small multiples but it is splitting each measure as seperate graph as above. 

How to do it without small multiples to achieve as primary and secondary axis like a normal graph??

 

The measure I used for the visualization and tabel - 

Selected Measesure All =
SWITCH(
    TRUE(),
    SELECTEDVALUE('CategoryTable'[Measure]) = "Wrvus/Visit", [Wrvus per Visit],
    SELECTEDVALUE('CategoryTable'[Measure]) ="Wrvus",[PivotWrvus],
    BLANK()  -- If neither 50th nor 65th is selected, return blank
)
 

Thanks so much in advance for your help!!

2 ACCEPTED SOLUTIONS

Yes, if you use line chart , you can use as many measure as you want using field value parameter option. See above example with 4 measure:

shafiz_p_0-1738214989663.png

With any 2 selection:

shafiz_p_1-1738215026870.png

 

But if you want to use line and column as combo like (Primary and secondary) then you need to adjust the provided measure. How? Use nested if statement or switch function for multiple choice. Let's say i want measure A, B, C to show as a column by selection, then create one measure A with else if statement. Same way other one.

Hope this solved your problem!!

If, please accept it as a solution!!

 

Best Regards,
Shahariar Hafiz

View solution in original post

Ritaf1983
Super User
Super User

Hi @Kalaivani 

In a situation where the metrics have similar proportions and can be compared, you can use a column in the measure table you created as a legend and display the graph with multiple measures based on the selection.
However, in the case of the metrics shown in the image, this is not feasible because the differences between them are too large to be displayed on the same scale.

Ritaf1983_6-1738218065942.png

Which means that two axes are needed.
To use two axes, you need two separate measures, each holding the selection from the slicer.
To make this dynamic and work even when there are more than two measures, you can use DAX. For example:
first selection =
var
min_selection =
min(measures_[Measure])
return
if (min_selection= "Wrvus",[Wrvus_],
if(min_selection= "Wrvus/Visit",[Wrvus/visit_],blank()))

Last selection =
var
max_selection =
MAX(measures_[Measure])
return
if (max_selection= "Wrvus",[Wrvus_],
if(max_selection= "Wrvus/Visit",[Wrvus/visit_],blank()))

 

This allows working with an unlimited number of measures, but the display will always be limited to two measures at a time, and the formula must explicitly list all possible options.

Ritaf1983_7-1738218129056.png

Additionally, for the legend to be meaningful, it cannot simply be "First Selection / Second Selection."
To overcome this, you can create measures that hold only the selected values and use them in text boxes to display the correct labels, while hiding the default legend.
The legend's font color can be changed to white to make it invisible.
fs = min('measures_'[Measure])
Ls = MAX('measures_'[Measure])

Ritaf1983_8-1738218225231.png

Although we managed to solve the technical challenge of displaying two different measures on a dual-axis chart, from an effective data visualization perspective, this approach is not recommended.

Combining different metrics in the same graph is misleading because the human brain naturally groups elements into a single unit (Gestalt principles).

When users first see the graph, their instinctive reaction is to compare the height of the lines—which is inherently incorrect, as these represent two entirely different metrics.

Even once they realize the mistake, they must still mentally filter out the distraction of the second line to focus on the first. This increases cognitive load, making the comparison harder than it should be.

A far better alternative is to use small multiples:
- They eliminate misleading height comparisons by clearly separating the measures.
- Each metric retains its own scale, ensuring correct interpretation.
- Because the graphs are aligned, users can still easily compare trends.

The goal of data visualization is not just to display information but to make interpretation effortless. A well-designed small multiples layout achieves this by reducing unnecessary cognitive effort while preserving clear, accurate insights.

Ritaf1983_9-1738218271924.png

From here, it's up to you how to proceed. In any case, I'm attaching a PBIX file with all the examples.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

8 REPLIES 8
Ritaf1983
Super User
Super User

Hi @Kalaivani 

In a situation where the metrics have similar proportions and can be compared, you can use a column in the measure table you created as a legend and display the graph with multiple measures based on the selection.
However, in the case of the metrics shown in the image, this is not feasible because the differences between them are too large to be displayed on the same scale.

Ritaf1983_6-1738218065942.png

Which means that two axes are needed.
To use two axes, you need two separate measures, each holding the selection from the slicer.
To make this dynamic and work even when there are more than two measures, you can use DAX. For example:
first selection =
var
min_selection =
min(measures_[Measure])
return
if (min_selection= "Wrvus",[Wrvus_],
if(min_selection= "Wrvus/Visit",[Wrvus/visit_],blank()))

Last selection =
var
max_selection =
MAX(measures_[Measure])
return
if (max_selection= "Wrvus",[Wrvus_],
if(max_selection= "Wrvus/Visit",[Wrvus/visit_],blank()))

 

This allows working with an unlimited number of measures, but the display will always be limited to two measures at a time, and the formula must explicitly list all possible options.

Ritaf1983_7-1738218129056.png

Additionally, for the legend to be meaningful, it cannot simply be "First Selection / Second Selection."
To overcome this, you can create measures that hold only the selected values and use them in text boxes to display the correct labels, while hiding the default legend.
The legend's font color can be changed to white to make it invisible.
fs = min('measures_'[Measure])
Ls = MAX('measures_'[Measure])

Ritaf1983_8-1738218225231.png

Although we managed to solve the technical challenge of displaying two different measures on a dual-axis chart, from an effective data visualization perspective, this approach is not recommended.

Combining different metrics in the same graph is misleading because the human brain naturally groups elements into a single unit (Gestalt principles).

When users first see the graph, their instinctive reaction is to compare the height of the lines—which is inherently incorrect, as these represent two entirely different metrics.

Even once they realize the mistake, they must still mentally filter out the distraction of the second line to focus on the first. This increases cognitive load, making the comparison harder than it should be.

A far better alternative is to use small multiples:
- They eliminate misleading height comparisons by clearly separating the measures.
- Each metric retains its own scale, ensuring correct interpretation.
- Because the graphs are aligned, users can still easily compare trends.

The goal of data visualization is not just to display information but to make interpretation effortless. A well-designed small multiples layout achieves this by reducing unnecessary cognitive effort while preserving clear, accurate insights.

Ritaf1983_9-1738218271924.png

From here, it's up to you how to proceed. In any case, I'm attaching a PBIX file with all the examples.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Hi @Ritaf1983  Thanks so so so much for taking your time to explain the user perspective. I will work on both options provided and decide which is more accurate and reasonable from user perspective.

Thanks again for your reply!!!!

Happy to help💌

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile
shafiz_p
Super User
Super User

Hi @Kalaivani  What I can understand that you want to create a slicer with multiple measure names and want to create a combo chart to show 2 different measures to 2 different axis like one measure in Y axis/Column and other one in Secondy Axis by slicer selection.

In general case, line chart ok enough to show different measure by field value selection. See example:

shafiz_p_3-1738210808139.png

 

However, to achieve this, create 2 different measure for 2 axis (Primary and Secondary). Your code would not work for this scenario because all the time it will be same. Try the below codes :

For Measure A:

A = 
IF(
    CONTAINSSTRING ( CONCATENATEX ( 'Select Measure', 'Select Measure'[Select Measure], "," ), "Total Plays" ), [TotalPlays]
)

 

For Measure B:

B = 
IF(
    CONTAINSSTRING ( CONCATENATEX ( 'Select Measure', 'Select Measure'[Select Measure], "," ), "Total Minutes" ), [TotalMinutes]
)

Here 'Select measure' is the field value.

 

I have used Line and stack column chart for this case. See images:



1. When nothing selected (You can modify measure to show different things if no selection made)

shafiz_p_0-1738209830699.png

 

2. With single selection:

shafiz_p_1-1738210034338.png

 

3. With multiple selection :

shafiz_p_2-1738210083133.png

 

 

Hope this helps!!

If the solved your problem, please accept it as a solution!!

Best Regards,
Shahariar Hafiz

Hi @shafiz_p  Thanks very much for your response. But I will be using more measures going forward. So let's say the slicer has 10 measure names. Whatever 2 measures the user selects, should show as 2 lines in the graph. Will that be possible? Thanks again!!

Yes, if you use line chart , you can use as many measure as you want using field value parameter option. See above example with 4 measure:

shafiz_p_0-1738214989663.png

With any 2 selection:

shafiz_p_1-1738215026870.png

 

But if you want to use line and column as combo like (Primary and secondary) then you need to adjust the provided measure. How? Use nested if statement or switch function for multiple choice. Let's say i want measure A, B, C to show as a column by selection, then create one measure A with else if statement. Same way other one.

Hope this solved your problem!!

If, please accept it as a solution!!

 

Best Regards,
Shahariar Hafiz

Thanks so so much @shafiz_p  

Happy to help!!

Helpful resources

Announcements
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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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