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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sameteskb
Frequent Visitor

How to do exception aggregation in Power BI?

sameteskb_1-1684160741464.png

Hello. I need something like this. You can compare the article by looking at the picture above;

 

I have a table with columns material type, calendar month/year, expense item, quantity.
For each material type [I'm only showing one (P) in the example], I want to return, on a monthly basis, the value with the highest cost item amount for that month and add the returned values to get a result total.

 

So the highest cost item value for January is 50.
The highest cost item value for February is 11
Highest cost item value for March 1400

 

When I add these the total result is 1461
This is what I want to do and want to see in Power BI.

 

However, although I tried various formulas in the Power BI section, I can't get the highest cost item value for that month and get a total result as I want. Can you help me?

1 ACCEPTED SOLUTION

@sameteskb 

Please try

Max Amount =
SUMX (
VALUES ( 'Table'[YearMonth] ),
MAXX (
CALCULATETABLE ( VALUES ( 'Table'[Expense Item] ) ),
CALCULATE ( SUM ( 'Table'[Amount] ) )
)
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @sameteskb 

please try

Expense Amount =
IF (
ISINSCOPE ( 'Table'[Expense Item] ),
SUM ( 'Table'[Amount] ),
CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Expense Item] = "Dogalgaz" )
)

 

please make sure to type Dogaldaz with the Turkish characters 

Thank you for the answer.

 

However, while the item with the highest cost item value for January and February is "Dogalgaz", the item with the highest cost item value for March is "Enerji". Therefore, this formula did not return a correct value.

 

I need the formula that returns the highest cost item value for that month and then sums these highest values.

 

thanks again

@sameteskb 

Please try

Max Amount =
SUMX (
VALUES ( 'Table'[YearMonth] ),
MAXX (
CALCULATETABLE ( VALUES ( 'Table'[Expense Item] ) ),
CALCULATE ( SUM ( 'Table'[Amount] ) )
)
)

thanks a lot. I caught the correct values in the breakdowns with this formula, but the result total value returns less value than it should, for some reason I don't understand. What do you think could be the reason?

 

I exported the table in Power BI to excel, I did not make any changes, the number of materials and the maximum amount are exactly the same. Then the results look essentially the same

 

sameteskb_0-1684236540224.png

------------------------------------------------------------------------------------

sameteskb_1-1684236556274.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.