Forum Discussion
Filter Only One Value In the X Axis Of Bar Chart By Using Slicer
- Anonymous2 years ago
Hi yigitarican
I'll start by showing you the test data I used and the date table that I used to create the slicer( from 2023.1.1 to 2023.5.31):You can use the following DAX to create measures to calculate the number of tasks corresponding to Waiting, Postponed and (null) values:
Waiting = COUNTROWS(FILTER('Table','Table'[Task Status] = "Waiting"))Postponed = COUNTROWS(FILTER('Table','Table'[Task Status] = "Postponed"))Blank = COUNTROWS(FILTER('Table','Table'[Task Status] = "blank"))For Completed Tasks, I use a separate DAX to count, which will apply the date interval in the slicer to dynamically calculate the number of Tasks:
Completed = CALCULATE( COUNT('Table'[Task Status]), FILTER( 'Table', 'Table'[Task Status] = "Completed" && 'Table'[Task Completion Date] >= MIN('Date_slicer'[Date]) && 'Table'[Task Completion Date] <= MAX('Date_slicer'[Date]) ) )Put 'Task Status' into the X axis and the 4 measures you just created into the Y axis:
And the final output is shown in the following figure:
Without slicer:
After applying slicer:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hello Anonymous,
Firstly, thank you for your help and your time. In slicer, I use "Task Completion Date" field as slicer value. Should I create seperate table for date? If so is there any way to update date table automatically as time moving foward?
- Anonymous2 years agoNot applicable
Hi yigitarican
Create seperate table for date is not required, I just chose to create it myself during the test, you can still choose to use "Task Completion Date" as slicer value.
And if you want to create a date table which is updated automatically as time moving foward, you can use the following DAX:Date_slicer1 = CALENDAR(DATE(2023,1,1), TODAY())'DATE(2023,1,1)' means that this date table is from 2023.1.1, and you can set this time by yourself, and 'TODAY()' means that the date table always ends today.