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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Aggregation for Same Period Last Year-

Hi Everyone,

 

I have an aggregate measure accumulating the sales as the months go on called "Actual TRG AGG"

edayan_0-1651139749193.png

 

edayan_1-1651139749354.png

 

I've highlighted above the portion relating to the Aggregating element but when I try to create the same measure for the year before:

edayan_2-1651139749216.png

 

You can see that I'm not able to maintain the aggregating element.. how do I keep the aggregation in the -1 measure?

 

Thanks,

Eyal

 

edayan_3-1651139749238.png

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , In the that max filter for cumulative you should use date table

 

filter(allselected('Date'),'Date'[date] <=max('Date'[date])

 

 

and for one year use the same calculation with

var _max = max('Date'[date])

var _date = date(year(_max), month(_max), day(_max) )

return

calculate([Actual TRG], filter(allselected('Date'),'Date'[date] <=_date ) , <Rest of the calc> )

 

 

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

4 REPLIES 4
Anonymous
Not applicable

@amitchandak is there a way to make this instead of sameperiodlastyear, to have it reference to last month?

 

edayan_0-1651920392073.png

 

Anonymous
Not applicable

Ok I found it based on your solution @amitchandak and here it is!

 

edayan_1-1651142162111.png

 

 

edayan_0-1651142145137.png

 

Anonymous
Not applicable

These are my filters in case I wasn't clear @amitchandak . And yes I switch from sales dates to calendar dates table. 

 

edayan_1-1651141855838.png

 

 

Thanks @amitchandak and tried it --> see '-1v2' below:

It gives the same as the original year. I need it to add(aggregate) so for February it would be the sum of the highlighted (371+408=779)

edayan_0-1651141651189.png

 

amitchandak
Super User
Super User

@Anonymous , In the that max filter for cumulative you should use date table

 

filter(allselected('Date'),'Date'[date] <=max('Date'[date])

 

 

and for one year use the same calculation with

var _max = max('Date'[date])

var _date = date(year(_max), month(_max), day(_max) )

return

calculate([Actual TRG], filter(allselected('Date'),'Date'[date] <=_date ) , <Rest of the calc> )

 

 

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.