Forum Discussion

dofrancis3's avatar
dofrancis3
Icon for Resolver I rankResolver I
2 years ago
Solved

Slicer based on Mesure

Dear Colleagues, Please i need your suport ! I would like to create a Slicer which can allow me to display “only Green chart” or “only Red chart” or two of them "red and Green). Below is my condition...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi dofrancis3 ,

    The Table data is shown below:

    Please follow these steps:
    1.Enter the following data manually.

     

    2.Use the following DAX expression to create a measure('sumValue' and 'target' correspond to your ' [%_Pop]' and '[%_Target]' respectively)

    Measure = 
    VAR _a = SELECTEDVALUE('Table (2)'[Column1])
    RETURN 
    SWITCH(TRUE(),
    _a = "red",IF([sumValue] <= [target] ,[sumValue],BLANK()),
    _a = "green",IF([sumValue] > [target] , [sumValue] , BLANK()),
    [sumValue])

    3.Final output

     

     Best Regards,
    Wenbin Zhou
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • xifeng_L's avatar
    2 years ago

    Anonymous 

    Your answers are excellent! And I would like to share some additional solutions below.

     

     

    dofrancis3 

    You can try below solution.

     

    step1. create a calculated table and use to slicer.

     

    ShowType = SELECTCOLUMNS({("Green",1),("Red",2),("Both",3)},"Type",[Value1],"Index",[Value2])

     

    step2. create a measure and use to visual filter.

     

    Show Control = IF(NOT ISEMPTY(INTERSECT(VALUES('ShowType'[Type]),{[Bar_chart_Couleur],"Both"})),1,0)

     

    The result as follow:

     

     

     

    Demo - Slicer based on Mesure.pbix

     

     

    Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !

     

    Thank you~

     

  • dofrancis3's avatar
    dofrancis3
    2 years ago

    Dear Colleagues!

    I'd like to thank you for your contribution to my request above.
    All your different solutions worked perfectly.
    Thank you again.