Daniel
Daniel

Reputation: 41

Power BI measurement between fixed Date and calculated Date

I'm interested in creating a report comparing a before and after of two equivalent time periods.

The after period is looking at the days from a fixed date (1/10/20) to the most recent case in the tbl_Data table (in this case it is 92 days).

The before period would subtract the calculated 92 days from the fixed date (1/10/20).

I was able to get the days between part fairly easily using the following:

Days_Between = 
calculate(
    countrows(date_table),
    DATESBETWEEN(
        date_table[Date_field].[Date],
        date(2020,10,01),
        MAX(tbl_Data[Date Received])
    )
)

However I'm at odds on how to subtract this from the fixed date to get a date range I can filter on easily. Any pointers/ideas would be greatly appreciated.

Cheers

Upvotes: 1

Views: 768

Answers (1)

W.B.
W.B.

Reputation: 5525

First, I would simplify your days calculation: Days_Between = DATEDIFF(date(2020,10,01), MAX(tbl_Data[Date Received]), DAY ). Then, I would simply subtract the result from the given date. Start date = Date(2020, 10, 1) - [Days_Between]

Upvotes: 1

Related Questions