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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Tob_P
Helper V
Helper V

SAMEPERIODLASTYEAR & Cumulative Total

Hi,

 

Couple of things I want to ask relating to SAMEPERIODLASTYEAR

 

My measure...

 

IVLA Actual SPLY = CALCULATE([Invoice Line Amount ACTUAL], SAMEPERIODLASTYEAR(Dates[Date]))
 
This works fine in a table when using Month as column, showing data for months so far this FY...
 
TobP6.png
 
..but struggling to get my head around why it would show data for months in the future...
 
TobP5.png
Not the end of the world, but would be cleaner if they didn't show?
 
Additionally, I would like to be able to show cumulative total for the total sales last year up to today's date last year, so in the example of the first table, the total sales between May & August last year. Is there a way to do this?
 
Finally, if I use a table to show the SAMEPERIODLASTYEAR measure, it gives me the total sales for the last year, rather than sales up to today's date last year in August.
 
TobP7.png
 
Date table is fine, date column has individual dates in it...just not sure where I'm going wrong for something so straightforward?
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Its showing months in the future because, although you don't have any sales yet this year, you did have sales for those dates last year. Easiest way to fix that is to add a column to your date table, something like

Today or before = 'Date'[Date] <= TODAY()

and then filter your visual to show only when that is true.

The problem with your table visual showing the values for the full year is happening because there is no filter on the date table - it will take the last date in your date table to work from, which is presumably 31st December 2022. You can either use the column generated above as a filter, again set to true, or use a relative date filter to show values in the last 0 or 1 calendar days, including today. That will give the values from Jan 1 to today last year. I think this will show what you are after for your second questions as well.

View solution in original post

2 REPLIES 2
Tob_P
Helper V
Helper V

@johnt75- thank you for this, worked perfectly on both fronts. You've helped me a few times now so thank you again!

johnt75
Super User
Super User

Its showing months in the future because, although you don't have any sales yet this year, you did have sales for those dates last year. Easiest way to fix that is to add a column to your date table, something like

Today or before = 'Date'[Date] <= TODAY()

and then filter your visual to show only when that is true.

The problem with your table visual showing the values for the full year is happening because there is no filter on the date table - it will take the last date in your date table to work from, which is presumably 31st December 2022. You can either use the column generated above as a filter, again set to true, or use a relative date filter to show values in the last 0 or 1 calendar days, including today. That will give the values from Jan 1 to today last year. I think this will show what you are after for your second questions as well.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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