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
Anonymous
Not applicable

Dynamic last december measure

 

I'm working on a measure to calculate the last December value so my measure is : 

 

Total  = CALCULATE(SUM('QPTOTAL'[Revenue]))
 Last December = CALCULATE(CALCULATE([Total],LASTDATE('Calendar'[Year/Month])),PARALLELPERIOD('Calendar'[Year/Month],-1,YEAR))
 
Do you have any idea to ameliorate this measure to a dynamic Last December, so I can have as result Last December 2018 Last December 2017 ..... When I select the year as a filter. 
 
Best regards.
Thank you 
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 
Please try this measure and check if it works for you

Measure = 
VAR _selectedYear = SELECTEDVALUE('Table'[Date].[Year])-1
RETURN CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),YEAR('Table'[Date])=_selectedYear && MONTH('Table'[Date])=12))

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous 
Please try this measure and check if it works for you

Measure = 
VAR _selectedYear = SELECTEDVALUE('Table'[Date].[Year])-1
RETURN CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),YEAR('Table'[Date])=_selectedYear && MONTH('Table'[Date])=12))

Thanks @Anonymous . I am facing the exact same issue. Your code works, but it sums the previous december value for my whole dataset. How can I make the measure account for the filters I apply in my report?

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.