Forum Discussion
Showing Only Total Labels for Stacked Bar Chart with Conditional DAX Logic
- 1 year ago
The code works fine when I kept both Data Labels and Total Labels turned on.
Data_Label = VAR SelectedTypes = ALLSELECTED(type_sort[type]) VAR SelectedCount = COUNTROWS(SelectedTypes) RETURN IF( SelectedCount = 1 && MAX(type_sort[type]) IN { "type-1", "type-2", "type-3" }, [describeMeasure], BLANK() )If I select only type-1
If I select combination of type-1/type-2/type-3
If I select only type-12
If I select any combination of type-1/type-2/type-3/type-12
Note: While ChatGPT provided the final working code, I had already shared the initial code, expected output, and other relevant details. It took a few iterations to get everything functioning correctly.
Thanks to everyone who engaged with my post and offered helpful suggestions, your input was truly appreciated!
Hi 0Experience,
(again) 🙂
I might have made it, the file is here, can you check this satisfies your requirements? The only thing that seems to me impossible is to hide the labels if you select multiple items differently than type1 and type-12
https://drive.google.com/drive/folders/14HuWjOKld9A5x-oHacplyMRa6J5rNyjd?usp=sharing
Hope I helped
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
FBergamaschiThank you so much for your time, your help, and the code you shared, I truly appreciate it.
It was good to see that the code worked partially. However, when I applied it to my actual dashboard, it unfortunately didn’t behave as expected (even for Type-12 and type-1) too. The data labels are still showing for every combination.
Still, I’m really grateful for your support and suggestions.
Thanks again!