Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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. 
  • 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

     

     

    Best Regards,
    Mariusz

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

     

2 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity 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

     

     

    Best Regards,
    Mariusz

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