Forum Discussion

MRN8840's avatar
MRN8840
Icon for Helper I rankHelper I
6 years ago

Same period last year visual

Hi!

 

I have this chart showing the water consumption for the last 15 days (red marking):

 

 

I would like to add a chart for the same 15 days last year (blue line). Can someone please explain to me how to do that? 🙂

4 Replies

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi MRN8840 

     

    You can use Measure like below.

    Sales Last Year = 
    CALCULATE(
        [Sales],
        SAMEPERIODLASTYEAR( 'Calendar'[Date] )
    )
    Best Regards,
    Mariusz

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

     

    • MRN8840's avatar
      MRN8840
      Icon for Helper I rankHelper I

      Thank you so much for you reply!

       

      It almost works - I would like it to automatically show the same day last year (today 21. of january), and the previous 15 days - just like the chart. How to write that in DAX? 😕

      • Mariusz's avatar
        Mariusz
        Icon for Community Champion rankCommunity Champion

        Hi MRN8840 

         

        Use your Previous 15 days measure as the first argument of calculate.

        CALCULATE(
            [Previous 15 days],
            SAMEPERIODLASTYEAR( 'Calendar'[Date] )
        )

         

        Best Regards,
        Mariusz

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

        Please feel free to connect with me.
        LinkedIn