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
andreazambon
Helper V
Helper V

Select a measure based on a filter selection

Hi there. 

 

I have a groups of machines which requires a measure based on meters and a group of machines which need the same measure but based on kilograms, and I don't want to create a twin-dashboard to show my data. 

 

My intenction is to work with a filter view where I can choose the groups of machines and based on my selection, use the rigt measure. 

 

For instance, something like (pseudo-code) 

 

Measure_um = if(Group = A || Group = C;"MeasureMeters";"MeasureKg")

 

 

Do you know if this strategy is feasible? 

 

Thankyou!

1 ACCEPTED SOLUTION

I use the custom visual "Toggle switch by TME AG" to switch between the values of a new table (with 2 elements, "m" and "kg"), and with the selected value, I change all the measures. 

Your solution is a bit risky because in my dashboard I have different views, each one uses a different measure expressed in m or kg. 

View solution in original post

4 REPLIES 4
andreazambon
Helper V
Helper V

@Greg_Deckler , thanks for your answer. 

Making the analysis, I've find out that is more complicated than i thought and than I described in my first post. 

 

The real situation is that only one group of machines needs to be valued in meters (GROUP A). If I need to select machines from differents groups and one of those groups is the group A, I need measure in kg. 

 

I managed this in a great way, with this trick:

 

1) create a measure with meters;

2)create a second measure equal to the first one but with kgs;

3) create a third measure with the condition (pseudocode):

 

if( and(SELECTEDVALUE(GroupTable[group])="A",[count_selected_groups]=1), Measure2, Measure1)

 

and it works fine!

Anyway, iI think that this is very restrictive. So I thought to create a measure wich contains only 2 values: "m" and "kg", and use a slicer based on that selection to swap the measure.

 

If I can ask.... how can I make that measure?

I tried with 

Measure = {"m","kg"}

 

nut it does not work 😛

if you want a slicer selection to switch the measures, consider using Field parameters, you will add bother your measures in and then add a slicer with the field parameter to switch

however now in your visuals you will need to have the field parameter as the value in your visuals instead of the old measures

If I answered your question please accept the reply as the solution 🙂

I use the custom visual "Toggle switch by TME AG" to switch between the values of a new table (with 2 elements, "m" and "kg"), and with the selected value, I change all the measures. 

Your solution is a bit risky because in my dashboard I have different views, each one uses a different measure expressed in m or kg. 

Greg_Deckler
Super User
Super User

@andreazambon Right, so generally this is done like the following:

Measure_um = 
  VAR __Group = SELECTEDVALUE('Table'[Group])
  VAR __Return = 
    SWITCH( TRUE(), 
       __Group = "A" || __Group = "C", [MeasureMeters],
       [MeasureKg]
    )
RETURN
  __Return

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.