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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Adding condition for DAX calculate and filter expression

Hi all,

 

I am working on creating a Title card for my dynamic report and need some help.

 

I have a list of holding companies and I want to create an expression that will allow the user to filter and pick an account and to automatically see the account's holding company in a card. I have been able to create the expression successfully:

 

Title = "Report C-" & CALCULATE(FIRSTNONBLANK(Table1[account], TRUE () ), FILTER (Table1, Table1[HoldingCompany] = TRUE ())

 

However, I also want to add a condition that if no account is picked, then the title card should say 'All Accounts". How do I add that condition in the expression? I keep getting an error when I try. Appreciate the help! Thank you

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous This will help:

(2) The Most Amazing, Mind Blowing Dynamic Slicer Titl... - Microsoft Power BI Community



Follow on LinkedIn
@ 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!:
DAX For Humans

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

@Greg_Deckler Hi Greg, I'm not sure I fully understand the measure. I just want to add "All Accounts" at the end of the measure? 

@Anonymous Not much to go on but maybe:

Title = 
  VAR __TOTAL_ROWS = COUNTROWS(DISTINCT(ALL('Table1'[account])))
  VAR __CURRENT_ROWS = COUNTROWS(DISTINCT('Table1'[account]))
RETURN
  IF(__TOTAL_ROWS = __CURRENT_ROWS(
    "All accounts",
    "Report C-" & CALCULATE(FIRSTNONBLANK(Table1[account], TRUE () ), FILTER (Table1, Table1[HoldingCompany] = TRUE ())
  )

 



Follow on LinkedIn
@ 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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.