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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Lastdecember dynamic results

Hello everyone,
 
I'm working on a dax that measures the results of Lastdecember revenue by selecting the year.  My dax formula is : 

A = CALCULATE(CALCULATE([Total Non-Quality],LASTDATE('Calendar'[Year/Month])),PARALLELPERIOD('Calendar'[Year/Month],-1,YEAR))

 

when I apply this formula I obtain these results by filtering on sites: Last December results = 14.98 (of 2018) for one site and the global is 27.81 (of 2018)

 

When I change this formula to select Last December revenue for each year it doesn't work especially when I filter by sites. So the formula that I used is : 

 
B = CALCULATE([Total Non-Quality],FILTER(ALL('Quality 12MR'),YEAR('Quality 12MR'[Date])=SELECTEDVALUE('Calendar'[Year/Month].[Year])-1 && MONTH('Quality 12MR'[Date])=12))
 
the results that I obtain are Last December results = 27.81 (of 2018) for one site and the global is 27.81 (of  2018) when I don't apply site as a filter, so it doesn't filter by site. 
 
Thank you for the response.
Best regards. 
1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try something like this.

Sales Dec Last Year = 
CALCULATE(
    [Sales],
    SAMEPERIODLASTYEAR( 'Calendar'[Date] ),
    'Calendar'[monthNo] = 12
)

 this will produce a result as below

 

image.png

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Try something like this.

Sales Dec Last Year = 
CALCULATE(
    [Sales],
    SAMEPERIODLASTYEAR( 'Calendar'[Date] ),
    'Calendar'[monthNo] = 12
)

 this will produce a result as below

 

image.png

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

 

Anonymous
Not applicable

 @Mariusz 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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