Forum Discussion
Axis Range change dynamically Based on slicer value
Hello,
I have a requirement to take a survey of the population based on age. While using slicers from 0 to 10, the x-axis value of the chart show 0-10,10-20,20-30...etc.based on ages in data .Likewise, my slicer value is 0 to 30 means, the x-axis value of the chart show 0-30,60-90,....etc.In X-axis the age should show data dynamically based on slicer values.
This is a sample of what I want to do. Please help to rectify this one. Thanks in Advance.
3 Replies
- AnonymousNot applicable
Hi Anonymous ,
Based on my test, I created two Range tables and used Bookmarks to realize your scenario.
Here is my data samples.
Step1: Create two measures for each range:
Range is 10 = SWITCH ( MAX ( 'Range(10)'[Range] ), "0-10", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] >= 0 && 'Age Table'[Age] <= 10 ) ), "10-20", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 10 && 'Age Table'[Age] <= 20 ) ), "20-30", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 20 && 'Age Table'[Age] <= 30 ) ), "30-40", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 30 && 'Age Table'[Age] <= 40 ) ), "40-50", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 40 && 'Age Table'[Age] <= 50 ) ), "50-60", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 50 && 'Age Table'[Age] <= 60 ) ), "60-70", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 60 && 'Age Table'[Age] <= 70 ) ), "70-80", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 70 && 'Age Table'[Age] <= 80 ) ), "80-90", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 80 && 'Age Table'[Age] <= 90 ) ), "90-100", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 90 && 'Age Table'[Age] <= 100 ) ) )Range is 30 = SWITCH ( MAX ( 'Range(30)'[Range] ), "0-30", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] >= 0 && 'Age Table'[Age] <= 30 ) ), "30-60", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 30 && 'Age Table'[Age] <= 60 ) ), "60-90", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 60 && 'Age Table'[Age] <= 90 ) ), "90-100", CALCULATE ( COUNTROWS ( 'Age Table' ), FILTER ( 'Age Table', 'Age Table'[Age] > 90 && 'Age Table'[Age] <= 100 ) ) )Step2: Create visuals on two pages and use each page as bookmark like this:
The final output is shown below:
Refer to:
Create report bookmarks in Power BI to share insights and build stories - Power BI | Microsoft Docs
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- AnonymousNot applicable
Hi Anonymous
Thanks for your response,this one make my work very easily.
One more question is there any way to use this one on same page without using bookmark,
beacause my requirement is x-axis value change dynamicaly based slicer value on same graph.I am new to power bi can you please help to get this one.
Thanks in advance
- AnonymousNot applicable
Hi Anonymous ,
Sorry...You may create a new thread in Power BI Desktop Community to get further help.😅
Best Regards,
Eyelyn Qin