Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

correct order TYD last year

Hi, 

 

I would like to have total year to date last year.

I have used 2 measures that will calculate this:
1.calculate(TotalYTD;sum(value);date(date));sameperiodlastyear(date(date)
2.TotalYTD(calculate(sum(value);sameperiodlastyear(date(date));date(date)

So 1 calculates TotalYTD first and then sameperiode last year, 2 is the opposite. 

Both shows the same answer, but I wonder which one is the best or optimal/correct?

  • Hi Anonymous ,

     

    As far as i am concerned, we think the first measure will be a little better, but it depends on different situation. We suggest you to use performance analyzer or Dax Studio to compare them in your own scenario.


    Best regards,

     

3 Replies

  • I typically prefer datesytd , total ytd or year behind measure. Check for Last to last YTD Sales

    YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
    This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))
    
    Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
    Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
    Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
    Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
    

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Ok  amitchandak , I see. 

      But are the 2 measures I used også correct and which one is the best/most logic,

  • v-lid-msft's avatar
    v-lid-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    As far as i am concerned, we think the first measure will be a little better, but it depends on different situation. We suggest you to use performance analyzer or Dax Studio to compare them in your own scenario.


    Best regards,