Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Default message to be written when all records are selected

Hello,

 

A slight modification is required to the below DAX measure. It is working fine but I need to include a default message when all the packages (category) are selected.  I tried but its not working at all.

 

On default all categories are selected in a slicer at that time its so messy as showing all values. I need to show a message " All values selected" to the below DAX

 

Packages selected =
IF(ISBLANK(
CONCATENATEX(
VALUES(Package_To_Include[Package]),Package_To_Include[Package], ", ")),
BLANK()," Packages selected are " &
CONCATENATEX(
VALUES(Package_To_Include[Package]), Package_To_Include[Package], ","))
 
Solution taken from:
 
Thanks,
Karthik
4 REPLIES 4
Greg_Deckler
Super User
Super User

@Anonymous You can download the PBIX from the solution at the bottom of the Quick Measure Gallery entry. Has all the formulas, etc. If you scroll down the entire formula is listed, here is the relevant snippet (below). And yes on the Card visual.

 

VAR __TOTAL_ROWS = COUNTROWS(DISTINCT(ALL('Table'[Brand])))
VAR __CURRENT_ROWS = COUNTROWS(DISTINCT('Table'[Brand]))
VAR __MAINTEXT = 
    IF(
        __USEPERCENT,
        VAR __PERCENT = DIVIDE(__CURRENT_ROWS,__TOTAL_ROWS,0)
        RETURN IF(ISBLANK(__PERCENT),__PERCENTZEROTEXT & __PERCENTTEXT,FORMAT(__PERCENT,"Percent") & __PERCENTTEXT),
        SWITCH(
            TRUE(),
            __CURRENT_ROWS = __TOTAL_ROWS,__ALLTEXT,
            __CURRENT_ROWS = 0,__NONETEXT,

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Thanks Greg. I will make changes and update here 🙂

Greg_Deckler
Super User
Super User

@Anonymous If I remember correctly from https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Most-Amazing-Mind-Blowing-Dynamic-Slicer-Title-Measure-Ever/td-p/429587. What I did was do a COUNTROWS('Table') and compare it with a COUNTROWS(ALL('Table')). If the 2 values are equal, then everything is selected. Might also be able to do a IF(NOT(ISFILTERED())...)


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Wow @Greg_Deckler .

This is what I was actually looking for. Is it possible for you to share the formula you used over here.

 

I like the way how you are saying " You have filtered over B1, B2, B3 and 4 more brands". I will also add a similar style in mine. Have you displayed that via card visual?

 

Thanks,

Karthik

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors