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.
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.