Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help with Dax measures - value diff by date

Hi team,
I need your help with four dynamic dax calculations. I have the following data:

Date

Value

01-Jan-2022 00:00:01 AM

  2

01-Jan-2022 03:15:00 AM

  7

01-Apr-2022 00:00:01 AM

  20

27-Apr-2022 11:59:00 PM

  25

30-Apr-2022 11:59:00 PM

  100

01-May-2022 00:00:01 АМ

   5

04-May-2022 01:00:00 AM

   20

04-May-2022 11:59:00 PM

   50

08-May-2022 03:00:00 AM

   3

08-May-2022 11:59:00 PM

   10

 

  1. YTD_Measure =  I need the difference between the last yesterday value and first value from the first day of current year.
    Ex: (08-May 11:59 PM – 01-Jan 00:00 AM)  10 -2 = 8
  2. Week_Measure = I need the difference between the last value from the last Wednesday and the last value from the earlier Wednesday
    Ex: (04-May 11:59PM – 27-Apr 11:59PM)  50-25 = 25
  3. MTD_Measure = I need the difference between the last yesterday value and the first value from the first day of current month
    Ex: (8-May 11:59PM -  01-May 00:00 АМ) 10 – 5 = 5
  4. LastMonth_Measure = I need the difference between the last value of last day of previous month and the first value of the first day of the previous month
    Ex: (30-Apr 11:59 PM – 01-Apr-2022 00:00 АМ)  100 – 20 = 80

The measures should calculate all values dynamically, regarding the selected date from a Date slicer.

Thank you.

1 Reply