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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
dp32
Helper I
Helper I

Exception aggregation

Hi,

I have a Pivot Table with a P&L account hierarchy. For some of the accounts, I need an exceptional aggregation other than sum.
E.g. for the account Depreciation Tangibles, the MTD values should not sum up to a QTD and YTD total, but just show the value of the last month of the quarter (or year).

How can I do this in Power BI?

 

Thanks in advance!

4 REPLIES 4
Anonymous
Not applicable

Hi @dp32,

Perhaps you can take a look at the following blog about the hierarchy level, then you can use if statement with filter check current hierarchy level and replace it will specific formula.

Clever Hierarchy Handling in DAX 
Regards,

Xiaoxin Sheng

amitchandak
Super User
Super User

If you have date table you can do like

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] =maxx(date,date[date])))

Or

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] =maxx(date,endofmonth(dateadd(date[date]),-1,month))))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

 

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

Thanks, but this will not result in an exception aggregation. It will then be applied to all accounts of the P&L hierarchy.

vivran22
Community Champion
Community Champion

Hello @dp32 

 

You can create measures using time intelligence functions like LASTDATE, CLOSINGBALANCEMONTH, CLOSINGBALANCEYEAR, CLOSINGBALANCEQUARTER, 

 

For this you would also need to create a calendar table.

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂

https://www.vivran.in/

Connect on LinkedIn

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors