Forum Discussion

Neal369's avatar
Neal369
New Member
3 years ago

Difference between Values - Based on Dates

Hi Friends,

 

I am having below excel data, 

How can we calculate difference between total sales values with regrads to current date and previous last date in table.

 

 

 

1 Reply

  • Neal369 , Select the distinct date in a new table and add  rank column on date

     

    Dates = distinct(Table[reportingDate])

     

     

    Add Rank, column

    rank = rankx(Dates , Dates[reportingDate] ,,asc,dense)

     

    join reporting date of both tables

     

    Then use measures like

     

    This date= CALCULATE(sum('Table'[sales]), FILTER(ALL('Dates'),'Dates'[rank ]=max('Dates'[rank])))
    Last date= CALCULATE(sum('Table'[sales]), FILTER(ALL('Dates'),'Dates'[rank ]=max('Dates'[rank])-1))