Forum Discussion
Change in category selection changes selected subcategory in slicers
I have a table which has 2 columns: Category and Sub-category. Category are A, B, C and sub category are A1,A2, A3, B1, B2, C1,C2,C3,C4. I am using both column in the slicer. Both slicers have been set at single select value. User will choose one category from slicer 1 and one sub-category from slicer 2. How can I automatically reset slicer so that first sub category correspons to the category is always selected. For instance, if user clicks on category A then A1 is selected, if user change the selection of category to B then B1 is selected. As of now, slicer always show the last selected sub category due to which visuals are going blank.
Hey, dikssha ; you can pull this off with a hack, sort of.
The thing with the non-disappearing previous selection is not fixable with default visuals; however, you can hack and adjust the behaviour.
The solution can look like this:
I have selected category B and subcategory B2. The table shows B2 correctly.
Then I select Category C. Subcategory will render C values with the B2 still selected. The table, however, will show hte first value for C category, so C1.
Lastly, I select new subcategory in C, so the B value will dissapear and Table will react to the subcategory selection.
If you have enough values, technically the preselected value can kinda dissapear. I don't think there's currently better way to do it.
The DAX that controls is set as Filter on visual level:
Measure Filter = var selectedCategory = SELECTEDVALUE(category[category]) var selectedSubCategory = SELECTEDVALUE(subcategory[subcategory]) var validSubCategories = CALCULATETABLE( VALUES(subcategory[subcategory]), subcategory[category] = selectedCategory, REMOVEFILTERS(subcategory) ) var isValidSelection = selectedSubCategory IN validSubCategories var alternativeSubCategory = MINX(validSubCategories, subcategory[subcategory]) var targetSubCategory = IF(isValidSelection, selectedSubCategory, alternativeSubCategory) var finalResult = CALCULATE( COUNTROWS('Table'), KEEPFILTERS(TREATAS({targetSubCategory}, 'Table'[subcategory])), REMOVEFILTERS(subcategory) ) return finalResultThe model looks like this:
I deliberately don't have a subcategory connected, which is a big disadvantage; to you can try playing with it, whether you make it work with the physical connection. Alternatively, if this is functionality just for one visual, you can have a separate dimension just for this, and then keep the rest of the report standard with proper relationships.
I am also attaching the report; you can try it yourself.
This is a really common issue when you have dependent slicers but no enforced relationship in the selection behavior.
From a technical side, Power BI doesn’t natively “reset” one slicer based on another selection — it will hold the last selected value, which is why you’re seeing blanks when the category changes.
A couple of approaches you could consider:
Using a hierarchy (Category → Subcategory) in a single slicer so the selections stay aligned
Creating a measure to handle default logic and avoid blanks in visuals
Or using synced slicers / bookmarks if you want more controlled behavior
That said, this is also one of those cases where it helps to think about the user experience.If changing Category can invalidate Subcategory, it might be worth either:
Clearing the subcategory selection automatically (instead of defaulting to one), or
Guiding the user with a visual cue when the selection becomes incompatible
I’ve run into similar situations where the bigger issue wasn’t the slicer behavior itself, but how easily a user could end up in a “no data” state without realizing why.Curious which direction you’re leaning — forcing a default selection, or making the interaction more transparent?
Hi dikssha
This feature is available the chiclet custom slicer visual but as the name says, it is s a chiclet/a button.
If you want to use a dropdown, you will have to modify a column's property in Tabular Editor. Please refer to this: https://community.fabric.microsoft.com/t5/Desktop/How-to-set-always-select-the-first-value-in-button-slicer/td-p/5000170
5 Replies
- vojtechsima
Super User
Hey, dikssha ; you can pull this off with a hack, sort of.
The thing with the non-disappearing previous selection is not fixable with default visuals; however, you can hack and adjust the behaviour.
The solution can look like this:
I have selected category B and subcategory B2. The table shows B2 correctly.
Then I select Category C. Subcategory will render C values with the B2 still selected. The table, however, will show hte first value for C category, so C1.
Lastly, I select new subcategory in C, so the B value will dissapear and Table will react to the subcategory selection.
If you have enough values, technically the preselected value can kinda dissapear. I don't think there's currently better way to do it.
The DAX that controls is set as Filter on visual level:
Measure Filter = var selectedCategory = SELECTEDVALUE(category[category]) var selectedSubCategory = SELECTEDVALUE(subcategory[subcategory]) var validSubCategories = CALCULATETABLE( VALUES(subcategory[subcategory]), subcategory[category] = selectedCategory, REMOVEFILTERS(subcategory) ) var isValidSelection = selectedSubCategory IN validSubCategories var alternativeSubCategory = MINX(validSubCategories, subcategory[subcategory]) var targetSubCategory = IF(isValidSelection, selectedSubCategory, alternativeSubCategory) var finalResult = CALCULATE( COUNTROWS('Table'), KEEPFILTERS(TREATAS({targetSubCategory}, 'Table'[subcategory])), REMOVEFILTERS(subcategory) ) return finalResultThe model looks like this:
I deliberately don't have a subcategory connected, which is a big disadvantage; to you can try playing with it, whether you make it work with the physical connection. Alternatively, if this is functionality just for one visual, you can have a separate dimension just for this, and then keep the rest of the report standard with proper relationships.
I am also attaching the report; you can try it yourself.
- donbuser
Resolver I
This is a really common issue when you have dependent slicers but no enforced relationship in the selection behavior.
From a technical side, Power BI doesn’t natively “reset” one slicer based on another selection — it will hold the last selected value, which is why you’re seeing blanks when the category changes.
A couple of approaches you could consider:
Using a hierarchy (Category → Subcategory) in a single slicer so the selections stay aligned
Creating a measure to handle default logic and avoid blanks in visuals
Or using synced slicers / bookmarks if you want more controlled behavior
That said, this is also one of those cases where it helps to think about the user experience.If changing Category can invalidate Subcategory, it might be worth either:
Clearing the subcategory selection automatically (instead of defaulting to one), or
Guiding the user with a visual cue when the selection becomes incompatible
I’ve run into similar situations where the bigger issue wasn’t the slicer behavior itself, but how easily a user could end up in a “no data” state without realizing why.Curious which direction you’re leaning — forcing a default selection, or making the interaction more transparent?
- danextian
Super User
Hi dikssha
This feature is available the chiclet custom slicer visual but as the name says, it is s a chiclet/a button.
If you want to use a dropdown, you will have to modify a column's property in Tabular Editor. Please refer to this: https://community.fabric.microsoft.com/t5/Desktop/How-to-set-always-select-the-first-value-in-button-slicer/td-p/5000170
- v-prasare
Community Support
Hi dikssha,
if our community members answer resolves your query or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
danextian, donbuser & vojtechsima, Thanks for your prompt response.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support - v-prasare
Community Support
Hi @dikssha,
if our community members answer resolves your query or if you need further help. If you still have any questions or need more support, please feel free to let us know. We are happy to help you.
Thank you for your patience and look forward to hearing from you.
Best Regards,
Prashanth Are
MS Fabric community support