Forum Discussion
Slicer issue with stacked column chart
I have a table, which mainly has two columns,
Table
CountColumn ServiceColumn
1 serviceA
2 serviceB
3 serviceC
4 serviceD
I have a stack column chart, which X-axis is ServiceColum, Y-axis is CountColumn
I want to use ServiceColumn as my slicer.
In this example, I have 4 service, which is serviceA serviceB serviceC serviceD
By default, if none in the slicer selected, it will show all 4 service in my stacked column chart.
And if I select one of the service in the slicer, it will only show one column in my stacked column chart.
Now, my question is how to make this happen: If none in the slicer selected, I want to have a default column, let's default column is serviceB.
I try to do this, create a measure
Hi, wangjian
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Test(a calculated table):
Test = DISTINCT('Table'[ServiceColumn])There is no relationship between two tables. You may create a measure as below.
Visual Control = IF( ISFILTERED(Test[ServiceColumn]), IF( SELECTEDVALUE('Table'[ServiceColumn]) in DISTINCT(Test[ServiceColumn]), 1,0 ), IF( SELECTEDVALUE('Table'[ServiceColumn])="serviceB", 1,0 ) )Finally you may put the measure in the visual level filter and use the 'ServiceColumn' from 'Test' table to filter the 'Stacked column chart'.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- AllisonKennedy
Community Champion
You could achieve similar result with the slicer by turning Single Select ON under selection controls in your slicer. This will force the slicer to choose a default single value. https://www.youtube.com/watch?v=IntX4sOLi6U - amitchandak
Super User
wangjian , Not very clear try like
new measure =
if(isfiltered(Table[ServiceColumn]), calculate(count(Table[Countcolumn]), filter(Table,Table[ServiceColumn] ="serviceB")),count(Table[Countcolumn]))
- v-alq-msft
Community Support
Hi, wangjian
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Test(a calculated table):
Test = DISTINCT('Table'[ServiceColumn])There is no relationship between two tables. You may create a measure as below.
Visual Control = IF( ISFILTERED(Test[ServiceColumn]), IF( SELECTEDVALUE('Table'[ServiceColumn]) in DISTINCT(Test[ServiceColumn]), 1,0 ), IF( SELECTEDVALUE('Table'[ServiceColumn])="serviceB", 1,0 ) )Finally you may put the measure in the visual level filter and use the 'ServiceColumn' from 'Test' table to filter the 'Stacked column chart'.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.