Forum Discussion

ybyb23's avatar
ybyb23
Frequent Visitor
4 years ago
Solved

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

3 Replies

  • ybyb23's avatar
    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 ? 

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ybyb23 ,

    Here is my test table:

    Table:

    Slicer:

     

    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"
        )

     

    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.