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

Calculate with multiple selections in same column

Why do I have 10 books on DAX formulas and Power BI and still can't find the answer to this easy problem?

 

I need this formula rewrote so it will work:

Intercompany Sales = CALCULATE(sum(Sales[Sales]),Sales[CustID]='10275' or '11969' or '12875' or '50013'

 

I need the total sales of all four of these CustID

 

I know I will be ashamed when I see the answer.  Thanks for your help.

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

Intercompany Sales = CALCULATE(sum(Sales[Sales]),Sales[Sales]=10275 || Sales[Sales]=11969 || Sales[Sales]=12875 || Sales[Sales]=50013)

This assumes numeric data in Sales. If Text, enclose in "".



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

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

Intercompany Sales = CALCULATE(sum(Sales[Sales]),Sales[Sales]=10275 || Sales[Sales]=11969 || Sales[Sales]=12875 || Sales[Sales]=50013)

This assumes numeric data in Sales. If Text, enclose in "".



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

Thank you so much @Greg_Deckler for answering this, and thank you for asking this question @Anonymous - great community, and this is extremely helpful.

Anonymous
Not applicable

This works perfectly.  I want to personally thank you for all you do on this board helping people like myself be more productive with our time.

Hi smoupre,

 

how would the formula look like if I wanted to filter for ranges? So Sales[Sales]>= 10275 and < 11969?

 

Thanks!

Right, so the filter clause can get complex quickly. So I believe something like this would work:

 

Intercompany Sales = CALCULATE(sum(Sales[Sales]),(Sales[Sales]>=10275 && Sales[Sales]<=11969) || Sales[Sales]=12875 || Sales[Sales]=50013)

 

So, that should be to include sales that are >= 10275 and <=11969 or exactly 12875 or exactly 50013



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

Hello @Greg_Deckler

 

I have the same issue, but I want to make it dynamic. For example, I have a slicer with 5 types of products and two measure:

 

SelectedProduct = FIRSTNONBLANK(Table[Product], Table[Product])
NumberProducts = CALCULATE(COUNTROWS(Table), FILTER(Table, Product=SelectedProduct))

What I want is the SelectedProduct to give me all(multiple) of the selected values from the slicer and calculate the NumberProducts for all of the selected. Please help me.

Thanks 🙂

 

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.