Forum Discussion

Scocal123's avatar
Scocal123
Icon for Helper I rankHelper I
3 years ago

Dynamic filter with rankings

Hello,

 

I have a dataset similar to the below:

 

ColourShadeValueRank
RedLight80008
BlueLight1000010
GreenLight40004
OrangeLight50005
PurpleLight20002
WhiteLight90009
BrownLight30003
BlackLight60006
VioletLight70007
YellowLight10001
RedDark142
BlueDark355
GreenDark213
OrangeDark497
PurpleDark426
WhiteDark568
BrownDark639
BlackDark71
VioletDark284
YellowDark639

 

The 'rank' column is ranking each colour based on the 'value' column, but is specific to the shade. So for blue it is ranked 10 for light, and 5 for dark. 

 

I am trying to create a chart that allows the user to be able to select a colour, say blue, and show a line/bar chart with the value of blue for the shade they have filtered to (light/dark), plus the nearest 2 rankings above and below the colour the user has selected.

 

So if I selected blue and had the page flitered to the shade dark, I would expect to see a chart which contains the below rows in a visual like a line/bar chart:

ColourShadeValueRank
GreenDark213
BelgiumDark284
BlueDark355
PurpleDark426
OrangeDark497

 

I am struggling identifying a way to do this which does not result with me having the chart filtered to 'blue' and nothing else, so any advice would be greatly appreciated!

2 Replies

  • Scocal123 , Try a measure like

     

    Rankx(filter(all(Table[Colour], Table[Shade]), Table[Shade] = max(Table[Shade])), calculate(Sum([Value])), ,asc,dense)

    • Scocal123's avatar
      Scocal123
      Icon for Helper I rankHelper I

      Thanks for the response! Unfortunately this doesn't appear to produce the outcome. I think this may be due to my poor description, apologies. 

      I believe I am looking for a measure that will allow me to have 'Colour' on the X-axis of a bar chart, and the sum of the 'value' column on the Y-axis. The visual will have a filter on it to specify whether the chart is showing light/dark from the 'shade' column.
      The problem is that for this measure, when the user selects the colour 'Blue' in a slicer, for example, I need the chart to show me the Sum value of the colour 'Blue', plus the 2 closest ranked values for that shade. For example, my chart would have the below values in it as a result of the measure where the visual is filtered to the shade 'dark':

       

       

      ColourShadeValueRank
      GreenDark213
      BelgiumDark284
      BlueDark355
      PurpleDark426
      OrangeDark49

      7

       

      Hope this makes sense & thanks for the help