Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How to process multiple selections from a slicer?

Hi,   I simplified the example here. Had a slicer where you could choose one value of 'Max' and 'Min'. Based on the choice the bar gets a color.   Measure =  VAR _metric = SELECTEDVALUE('Chosen...
  • Ritaf1983's avatar
    2 years ago

    Hi Anonymous 

    If i understood you correctly you are trying to catch 2 values from the slicer , you can use min for lowest selection,
    max for highest. 

    For example, with the simple list, it looks like :

     


    your formula will look something like :

    Measure = 
    VAR  metric_min = min('Chosen Values'[ID])
    Var metric_max = max(Chosen Values'[ID])
    .
    .
    .
     
    if i missed something 

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...
    Please show the expected outcome based on the sample data you provided.

    https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

     

  • MFelix's avatar
    MFelix
    2 years ago

    Hi Anonymous ,

     

    Try the following code:

    YOY difference CF = 
    
    VAR _aantalmaanden = 
    COUNTROWS(
        ALL('Date'[Month Name Short], 'Date'[Month])
    )
    
    VAR _metric = SELECTEDVALUE('Top 3'[Num])
    
    VAR colorall= 
    SWITCH(
        TRUE,
         [RANK YOY difference] <= 3 && [YOY difference %] > 0 , "Green",                      -- Top 3 Increases
         [RANK YOY difference] > _aantalmaanden - 3  && [YOY difference %] < 0, "Blue",      -- Top 3 Decreases
         "Light Grey"
    )
    
    VAR _color =
    SWITCH(
        TRUE,
         _metric = 1 && 
         [RANK YOY difference] <= 3 && [YOY difference %] > 0 , "Green",                      -- Top 3 Increases
         _metric = 2 && 
         [RANK YOY difference] > _aantalmaanden - 3  && [YOY difference %] < 0, "Blue",      -- Top 3 Decreases
         "Light Grey"
    )
    
    RETURN
    IF(COUNTROWS('Top 3') = 1, _color, colorall)