Forum Discussion
DAX Measure Not Showing Correct Slicer State (All Selected, No Selection, Partial Selection)
- 1 year ago
Hi chetan8080 ,
Thanks for the response.
Could you please provide sample data that fully represents the issue or question you're referring to? Kindly ensure the data is in a usable format (e.g., PBIX,Excel or CSV) rather than a screenshot, and does not contain any sensitive or unrelated information.
Looking forward to your response.
Best regards,
Lakshmi.
Hi, You can use this sample code,
But your end users would need to understand when None is selected (Select All not checked) it actually means everything is selected.
Display =
VAR SelectedRegionsCount =
COUNTROWS(VALUES('Table'[REGION]))
VAR TotalRegionsCount =
COUNTROWS(ALL('Table'[REGION]))
RETURN
SWITCH(
TRUE(),
SelectedRegionsCount = 0,
"Please select a region",
SelectedRegionsCount = TotalRegionsCount,
"All regions selected",
"Regions selected: " &
CONCATENATEX(
VALUES('Table'[REGION]),
'Table'[REGION],
", "
)
)
- chetan80801 year ago
Helper II
Hi MasonMA , thank you for responding.
I need the dax to display "Please select a region" when nothing is selected from the slicer.- MasonMA1 year ago
Super User
Hi, then i would suggest disabling 'Select All' and use below sample code
Display = VAR _SelectedRegions = VALUES('Table'[REGION]) VAR _SelectedRegionsCount = COUNTROWS(_SelectedRegions) VAR _TotalRegionsCount = COUNTROWS(ALL('Table'[REGION])) VAR _IsFiltered = ISFILTERED('Table'[REGION]) VAR _result= SWITCH( TRUE(), NOT _IsFiltered || _SelectedRegionsCount = 0, "Please select a region", _SelectedRegionsCount = _TotalRegionsCount, "All regions selected", "Regions selected: " & CONCATENATEX( _SelectedRegions, 'Table'[REGION], ", " ) ) RETURN _result- chetan80801 year ago
Helper II
Hello MasonMA
this dax is not working as expected see below pictureWhen I select all it should show "All Regions Selected"