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