powerbidax

Diff date cumulated


I need to calculated a difference (+1) between date but the end date is static for each value. And I need to collect the information for use it for another formula. (in this case date diff date *5) I can't add the difference in a table because the dataset is not mine. I can only use DAX.

First DATE End DATE data diff Result
01/01/2024 02/01/2024 2 10
01/01/2024 03/01/2024 3 15
01/01/2024 04/01/2024 4 20

I try the formula diff date but I don't know how to select the last date. I need a DAX formula


Solution

  • Before I created [Primo mese]

    and after I have done the following formula

    Diff = 
    VAR EndDate = LASTDATE(DIM_DATE[Date])
    VAR DateDiff = DATEDIFF([Primo mese], EndDate, DAY) + 1 
    RETURN DateDiff * 5