Forum Discussion
Slicer issue.
- 5 months ago
Hi Suman2505855 ,
You can achieve this by creating a simple measure and using it as a filter on the Department slicer.
Dept Visible = IF( CALCULATE(COUNTROWS('HR Table')) > 0, 1, 0 )After creating this measure, select the Department slicer and add this measure to the Filters pane. Set the filter to is 1.
This will ensure the slicer shows only departments that have data for the selected month.
FYI:
For more details, I’ve attached the PBIX file. Please take a look and let me know if anything needs to be adjusted or if you need any additional information.
Hi Suman2505855 ,
This behavior isn’t really determined by whether the department is in a fact table or a dimension table.
In Power BI, slicers don’t automatically filter each other, even if there are relationships. The Month slicer will filter the data, but the Department slicer continues to display all values unless we set it up otherwise.
One straightforward approach is to create a measure that checks if a department has data for the selected month, and then use this measure to filter the slicer. This ensures only relevant departments appear dynamically.
I hope this clarifies the situation. If I’ve misunderstood any part of your situation, please let us know.
Hi V-yubandi-msft,
Could you please provide the DAX functions required to achieve this?
Thanks and regards,
Suman
- V-yubandi-msft5 months agoCommunity Support
Hi Suman2505855 ,
You can achieve this by creating a simple measure and using it as a filter on the Department slicer.
Dept Visible = IF( CALCULATE(COUNTROWS('HR Table')) > 0, 1, 0 )After creating this measure, select the Department slicer and add this measure to the Filters pane. Set the filter to is 1.
This will ensure the slicer shows only departments that have data for the selected month.
FYI:
For more details, I’ve attached the PBIX file. Please take a look and let me know if anything needs to be adjusted or if you need any additional information.