Forum Discussion
Dynamic Y-axis based on slicer selection
Hi All,
Is it possible to dynamically change the bucket range % in Y-axis based on the user selection from slicer?
For example,
I have a Y-axis bucket range starting from 1% and end at 50%. If I increase/decrease the value from slicer then Y-axis range in bar chart should change by keeping values passed from slicer as a diference between bucket value.
If I select 3 in slicer then Y-axis should be 1%-3%, 4% - 6% , 7% - 9% etc., Please refer the below attached image.
Thanks,
Arul
Hi Arul,
My approach was to
- Create a list of all the possible axis values
- Create an increment table list for the slicer
- Use a measure to filter the bar chart, using the value on the slicer
Axis Filter 2 = MOD(SELECTEDVALUE('Axis Values'[Y Axis]), SELECTEDVALUE(Interval[N]))This is equal to 0 for all the multiples of the increment, so will only give you the y axis values you need once you've applied it as a filter (I've only gone up to 10 here).
The measure in the chart is then using the current bucket range, which is N in size.
measure = CALCULATE( COUNTROWS('Table'), 'Table'[Column1] <= SELECTEDVALUE('Axis Values'[Y Axis]), 'Table'[Column1] > SELECTEDVALUE('Axis Values'[Y Axis]) - SELECTEDVALUE(N[N]) )COUNTROWS('Table') can be whatever measure you're calculating.
Would that work? You might need to change some parts but the general idea should be ok I hope. (Maybe an additional column to add the "%" to the labels?)
1 Reply
- AntonioMSolution Sage
Hi Arul,
My approach was to
- Create a list of all the possible axis values
- Create an increment table list for the slicer
- Use a measure to filter the bar chart, using the value on the slicer
Axis Filter 2 = MOD(SELECTEDVALUE('Axis Values'[Y Axis]), SELECTEDVALUE(Interval[N]))This is equal to 0 for all the multiples of the increment, so will only give you the y axis values you need once you've applied it as a filter (I've only gone up to 10 here).
The measure in the chart is then using the current bucket range, which is N in size.
measure = CALCULATE( COUNTROWS('Table'), 'Table'[Column1] <= SELECTEDVALUE('Axis Values'[Y Axis]), 'Table'[Column1] > SELECTEDVALUE('Axis Values'[Y Axis]) - SELECTEDVALUE(N[N]) )COUNTROWS('Table') can be whatever measure you're calculating.
Would that work? You might need to change some parts but the general idea should be ok I hope. (Maybe an additional column to add the "%" to the labels?)