Forum Discussion
Use slicer control x-axis range
Hi all,
I would like to build a stacked column chart and use a slicer to control the range of the x-axis without changing the value of the axis. (Just like changing the minumum and maximum number in Format - X-axis, but with a slicer).
For example, the chart shows the cumulative amount of products sold since year 2005. (The data source is additional products sold each year, so I used a running total measure to let the chart display the cumulative amount of products.)
2005:5,
2006:14 (9 products sold in year 2006, so a total of 5+9=14 products are sold)
2007: 21
2008:23.....
when slicer is: year : 2005 - 2023, the chart should have 19 columns ( 2005 : 5, 2006 : 14, 2007 : 21, 2008 : 23,..., 2023 : 900)
when slicer is: year : 2007 - 2023, the chart should have 17 columns ( 2007 : 21, 2008 : 23,..., 2023 : 900).
I have tried to use a slicer directly, but this when slicer is year: 2007 - 2023, the chart gives me ( 2007 : 7, 2008 : 9,..., 2023 : 886), which is not what I want.
Thanks in advance for your help!
Hi Anonymous ,
How are you calculating the running total value it seems to me that you are using the values only for the selected period making the values to restart when you select each of the values.
You need to have a measure similar to this one:
Running sum = CALCULATE(SUM('Table'[Sold]), 'Table'[Year] <= MAX('Table'[Year]))Has you can see in the image below the values that are filtered continue to have the cumulative amounts.
2 Replies
- MFelixSuper User
Hi Anonymous ,
How are you calculating the running total value it seems to me that you are using the values only for the selected period making the values to restart when you select each of the values.
You need to have a measure similar to this one:
Running sum = CALCULATE(SUM('Table'[Sold]), 'Table'[Year] <= MAX('Table'[Year]))Has you can see in the image below the values that are filtered continue to have the cumulative amounts.
- AnonymousNot applicable
Hi MFelix ,
Thanks for your help! I modified my measure according to the example you gave, and it works for me right now!
Your quick response really helped me a lot! Thanks again!