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
ccarpent
Helper IV
Helper IV

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

@ccarpent , Try like

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@ccarpent , Try like

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

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