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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
SmithaKMurthy
New Member

Display multiple measure values based on slicer selection

Hi All,

I have around 15 measures in my model, which I need to show in a visual (line chart). The chart becomes unreadable if I add all of them directly. Hence, I thought of grouping the measures and providing a slicer to choose one or more of the groups to be displayed in the visual. I have created a table with the below structure-
Index | Measure Type | Measure Name
The table is not linked to any other table in my model. I have created a hierarchy out of this and added it as a slicer shown below-

SmithaKMurthy_0-1670413932382.png

I have created a measure as below  to display the data in a line chart-

SmithaKMurthy_1-1670414028698.png

The issue that I'm facing is that the line chart fails to render when I select all (or more than 1) measure type or more than one measure under a specific type. My goal is to allow the user to select a group (such as Geographic Measures) and be shown a graph with multiple lines, each corresponding to the the separate measures like FIRM_CITY_FILL%, FIRM_STATE_FILL% etc.

Could someone please guide me on this?

1 ACCEPTED SOLUTION

Hi All,

The solutions suggested above did not suit my requirement. I was finally able to achieve it by using Field Parameters. This artcile contains the details and the usage of Field Parameters. 
https://exceltown.com/en/tutorials/power-bi/powerbi-com-and-power-bi-desktop/power-bi-charts-and-vis...
Additionally, since I needed the measures to be grouped as per a specific hierarchy, I edited the DAX generated for the Field Parameter table and added an additional column that helped me set-up the hierarchy. The below video has a similar explanation-
https://youtu.be/qlhcN3A0HNU

I now have all my measures in a slicer, arranged in a specific hierarchy. I have one single visual, wherein I can show the value of any of the measures from the slicer, or a group from the slicer.

View solution in original post

7 REPLIES 7
Aburar_123
Resolver IV
Resolver IV

or you can try like this,

 

Aburar_123_0-1670421740549.png

HighQuality = switch(true(),max('Measure Category'[Measure Category])="Fruit",[HighQualityFruit],
max('Measure Category'[Measure Category])="Veg",[HighQualityVeg])
 
MostSold = switch(true(),max('Measure Category'[Measure Category])="Fruit",[MostSoldFruit],
max('Measure Category'[Measure Category])="Veg",'Measure Table'[MostSoldVeg])

Hi All,

The solutions suggested above did not suit my requirement. I was finally able to achieve it by using Field Parameters. This artcile contains the details and the usage of Field Parameters. 
https://exceltown.com/en/tutorials/power-bi/powerbi-com-and-power-bi-desktop/power-bi-charts-and-vis...
Additionally, since I needed the measures to be grouped as per a specific hierarchy, I edited the DAX generated for the Field Parameter table and added an additional column that helped me set-up the hierarchy. The below video has a similar explanation-
https://youtu.be/qlhcN3A0HNU

I now have all my measures in a slicer, arranged in a specific hierarchy. I have one single visual, wherein I can show the value of any of the measures from the slicer, or a group from the slicer.

Aburar_123
Resolver IV
Resolver IV

Hi @SmithaKMurthy ,

this is because of at last you are using single measure (measureSelection) in the Bar chart so it gives single value and Switch also will return single value. For example you can check what value is returned from the below Switch.

 

SWITCH(TRUE(),

MeasureType="FruitRelated" && MeasureName="CostlierFruitPrice",1,

MeasureType="FruitRelated" && MeasureName="HighestSoldFruitQuantity",2,

MeasureType="VeggieRelated" && MeasureName="CostlierVeggiePrice",3)

 

Just Select the MeasureType as FruitRelated in the slicer and check what this measure returns eiter 1 or 2 or both.

 

One suggestion is, you can try with Calculation group in this case.

 

Please Accept it as a Solution if it solves your Problem. Thanks.

 

 

 

mh2587
Super User
Super User

Create Table for measures and name the corresponding measures in the table e.g Measures_Nmae after that create measure with the combination of switch() and SelectedValue() using and return the measure with Measures_Name in the Query 


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Hi,
Thanks for the reply. I don't quite follow what you are saying. I already have a table of measures and even a measure for the selection with the SWITCH(). But it doesn't seem to work. Since I can't share the actual data, I have tried to mock my problem with some silly data-
I have two tables as below-

SmithaKMurthy_0-1670416759782.pngSmithaKMurthy_1-1670416785187.png

I have a slicer as below-

SmithaKMurthy_2-1670416820995.png

The measure for the slicer selection is written as below-

SmithaKMurthy_3-1670416933957.png

When I try to see the value of this MeasureSelection, I always end up with the default value. I don't get the outputs of other cases. What am I missing?

Try with subcategory I mean avoid && condition it often create ambiguity


Did I answer your question? If so, please mark my post as a solution!


Proud to be a Super User!




LinkedIn Icon
Muhammad Hasnain



Do you mean like this?

SmithaKMurthy_0-1670417453843.png

This won't work for multiple selections. That's the problem with my original question too.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.