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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ybyb23
Frequent Visitor

Measure as filter with multiple groups

Hi all, 

I have created a traffic light measure with multiple condition which are already based on other measure calculations. 

 

The idea is to use the measure as Slicer I have read there is a workaround to create table out of the measure output, but I am sure this could work with multiple conditions. 

 

My measure looks like this : 

 

Traffic Light = SWITCH (
TRUE (),
[A Analysis]+[B Analysis]+[Analysis C]=BLANK(), "Non Matching Pair",
[Analysis C]<0 && [A Analysis]>0 &&'Key Measures'[B Analysis]<0,"Price decrease while A increased",
[B Analysis]<0 && ('Key Measures'[B Analysis]<[A Analysis]),"Price decrease > A decrease",
[B Analysis]<0 && ('Key Measures'[B Analysis]>[A Analysis]),"Price increase < A increase",
[Analysis C]>0 &&[A Analysis]<0 && 'Key Measures'[B Analysis]>0,"Price increase while A decreased",
[B Analysis]<0 && 'Key Measures'[A Analysis]<0,"Price decrease < A decrease",
[B Analysis]>0 && 'Key Measures'[A Analysis]>0,"Price increase > A increase"
 
Hope you have answer to create slicer out of this condition, thank you
1 ACCEPTED SOLUTION
ribisht17
Super User
Super User

@ybyb23 

 

Here are a few examples 

 

Solved: Measure as Slicer - Workaround? - Microsoft Power BI Community

 

Solved: How to use a measure as slicer? - Microsoft Power BI Community

 

Regards,

Ritesh

Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @ybyb23 ,

Here is my test table:

Table:

vbinbinyumsft_0-1658295557507.png

Slicer:

vbinbinyumsft_1-1658295585650.png

 

1.create a slicer visual with slicervalue

2.create a dax formula and add it to table visual

Traffic =
VAR _slicerval =
    SELECTEDVALUE ( Slicer[SlicerValue] )
RETURN
    SWITCH (
        TRUE,
        MAX ( 'Table'[A] ) + MAX ( 'Table'[B] )
            + MAX ( 'Table'[C] )
            = BLANK ()
            && _slicerval = 0, "Non Matching Pair",
        MAX ( 'Table'[C] ) < 0
            && MAX ( 'Table'[A] ) > 0
            && MAX ( 'Table'[B] ) < 0
            && _slicerval = 1, "Price decrease while A increased",
        MAX ( 'Table'[B] ) < 0
            && MAX ( 'Table'[B] ) < MAX ( 'Table'[A] )
            && _slicerval = 2, "Price decrease > A decrease",
        MAX ( 'Table'[B] ) < 0
            && MAX ( 'Table'[B] ) > MAX ( 'Table'[A] )
            && _slicerval = 3, "Price increase < A increase",
        MAX ( 'Table'[C] ) > 0
            && MAX ( 'Table'[A] ) < 0
            && MAX ( 'Table'[B] ) > 0
            && _slicerval = 4, "Price increase while A decreased",
        MAX ( 'Table'[B] ) < 0
            && MAX ( 'Table'[A] ) < 0
            && _slicerval = 5, "Price decrease < A decrease",
        MAX ( 'Table'[B] ) > 0
            && MAX ( 'Table'[A] ) > 0
            && _slicerval = 6, "Price increase > A increase"
    )

vbinbinyumsft_2-1658295697006.png

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

ybyb23
Frequent Visitor

Hi, 

 

Thanks for your answer. Still through these examples I am facing some errors to get the slicer based on the measure that I have created. Basically thsis how my table looks like

Dim1dim2dim3ABCTraffic
Breadflour145870.69%-100%-100%Price decrease < A decrease 
Breadflour14759-8,32%-100-100Price decrease < A decrease
Breadflour45697   Non Matching pair
Breadflour13545   Non matchin pair
Breadflour54987   non matching pair 
Breadflour24687   non mtaching pair

 

based on what I have understood that's what I have to do: 

 

First : Create a table, I did in my case it will be 

Traficlight_Name                                                      SlicerValue

Non Matching Pairr                                                         0

Price decrease while A increase                                      1

Price decrease > A decrease                                           2

Price increase < A increase                                             3

Price increase while A decreased                                   4

Price decrease < A decrease                                          5

Price increase > A increase                                            6

 

I am missing the second step which I don't really understand if I have to write down again the conditions in my previous measure or what really has to be done in this step ? 

 

ribisht17
Super User
Super User

@ybyb23 

 

Here are a few examples 

 

Solved: Measure as Slicer - Workaround? - Microsoft Power BI Community

 

Solved: How to use a measure as slicer? - Microsoft Power BI Community

 

Regards,

Ritesh

Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.