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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate SUM amount which is base don the current filter context

Hi

 

I am wanting to add a measure that will sum or calculate the total 'Budget' amount for each 'Code' which is shown in the pivot or matrix.  The results are using a filter context based on the two measures* I added to the matrix; e.g. "TOTAL A 5K+", which look as values equal to or above 5k.

 

My table, or PowerPivot/Matrix.  

 

CODEBudget*TOTAL A 5K+*TOTAL ORDERS 5K+
QE660759                     5,910.00
QE6666311                     9,575.32
QE6666516                   8,690.55
QE665617                   7,395.53
QE666310                     6,070.22
QE77737                     8,746.00
QE77798          7,919.40                 5,767.39
QE839660                   7,666.00
QE-3596                     5,266.60
QE-396666                     5,932.60
QE-666661        9,000.00 
QE-666697                   5,944.00
QE-66565          7,570.00                   5,770.00
QE-66675                   5,288.00
QE-66870                   6,304.40
QEB0563                     6,900.00
QEB0637                     5,596.58
QEE8182                     5,533.50
QEE8363        6,848.00                 5,844.00
QE1110                   9,053.66
QE80660                     9,757.00

 

My measure example - *TOTAL A 5K+:=CALCULATE(SUM([FieldName]), TableName[FieldName]>=5000)

 

There are over 1k codes, I am just using the 2 measures above to identify any areas that are 5k value but I want to show the  correpodaning 'Budget' amount to that correspoding  'Code'; each code has its own budget to spend.  When I add a SUM()or CALCULATE() FUNCTION I still get all the codes in the table.  Suppose I am just highlighting the Top n  codes that are more than 5k, but I would like to know how you woudl go about thi susing DAX?

 

Many thanks

Chris

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

sumx(filter(summarize(Table,Table[CODE],"_1",SUM([FieldName])),[_1]>5000),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

sumx(filter(summarize(Table,Table[CODE],"_1",SUM([FieldName])),[_1]>5000),[_1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Amitchandak

 

Thats for the reply, however the formula is not working however I feel this is maybe due to my data model.  For example the code element works off a related table.  I have alos noticed a flaw in my design, trying to create two measures to flag values from opposite spectrums could add confusion to the results.  It was useful though to see your solution, which adds to my knowledge and use and apply theses functions.  Again many thanks for your help.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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