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

Total of all which have a certain value

I am failing on this particular subject which, at first, seemed quite doable to me.

 

In theory, I have the following table.

 

CountrySales
Germany20000
France22000
Belgium8000
The Netherlands10000
UK17000
Spain12000
Italy14000
Sweden 8500
Norway6000

 

I would like to have the total of sales of all countries where sales is > 12000. This would equal in above result to the sum of Germany, France, UK, Italy, so 73000.

 

I need this to get back in a measure as a fixed value. My model holds seperated facts and dimensions. I am trying this with the following formula:

 

Calculate(sum(sales) , filter( all(DimCountryTable) , sum(sales) > 12000).

 

This will simply add up the total sales of all countries but will only show for those countries with sales above 1200. Not what I want.

 

What I am basically want to achieve is this result if I make a grid. Please keep in mind, a fixed table is not an option for me as slicers still need to keep functioning.

 

CountrySalesSales2
Germany2000073000
France2200073000
Belgium800073000
The Netherlands1000073000
UK1700073000
Spain1200073000
Italy1400073000
Sweden 850073000
Norway600073000

 

Thank you in advance!

 

5 REPLIES 5
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Don't think about it too complicated, try

Measure = CALCULATE(SUM(DimCountryTable[Sales]),FILTER(ALL(DimCountryTable),DimCountryTable[Sales]>12000))

 6.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Anonymous
Not applicable

@v-jayw-msft Thanks for your answer.This formula is similar to what I posted in OP and does not work in a model with normalized model.

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this measure:

_Sum_GT12000 = SUMX(SUMMARIZE('Table', 'Table'[Country], "Total", CALCULATE(SUM('Table'[Sales]))), IF( [Total] >=12000, [Total], BLANK()))


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



amitchandak
Super User
Super User

@Anonymous , Try a measure like

sumx(filter(summarize(Table,DimCountryTable[Country],"_1",sum(Table[sales])),[_1]>12000),[_1])

Greg_Deckler
Super User
Super User

@Anonymous  - I think you can get what you want by using the same technique that is used for measure totals. Basically, create the table you want as a var and then sum and filter across it. 
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


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

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.