Forum Discussion

sandy8910's avatar
sandy8910
Frequent Visitor
5 years ago

Sameperiod LASTYEAR MTD

Hi Everyone,

 

Here is the issue:

 

Need to compare the revenue of 1st Jul'21 - 8th Jul'21 with the revenue of 1st Jul'20 - 8th Jul'20. When I use:

 

Calculate([total revenue],SAMPEPERIODLASTYEAR(dimdate[date]))

 

It compares the following:

 

revenue of 1st Jul'21 - 8th Jul'21 with the revenue of 1st Jul'20 - 31st Jul'20

 

Please help.

6 Replies

  • Selva_Salimi's avatar
    Selva_Salimi
    Frequent Visitor

    Hi sandy8910 

     

    you can add a filter to your measure expression:

     

    calculate([total revenue]),SAMEPERIODLASTYEAR('dimdate'[date]),filter('Table', DAY('Table'[date])<= DAY(max('Table'[date]))))
     
    Did I answer your question? Mark my post as a solution!
    • sandy8910's avatar
      sandy8910
      Frequent Visitor

      Thansk Selva for help.

       

      When I apply filter on dim table it gives nothing. No error. No value. can you please specifiy if you are refering to apply the filter on the data table where I am pulling the revenue from?

  • Hi,

    Ensure that the last date in the Dimdate table goes only uptil today's date.

    • sandy8910's avatar
      sandy8910
      Frequent Visitor

      Thanks Ashish however that I dont want to do as other visuals are using future dates as well

      • Ashish_Mathur's avatar
        Ashish_Mathur
        Icon for Super User rankSuper User

        Hi,

        Share the link from where i can download your PBI file and show the expected result.