Live Weeks Approval.pbix (64.6 KB) Approvals.xlsx (9.7 KB)
Dear DNA Team,
I have created a rolling calendar using m-code.
The attached excel data is loaded to PBI model.
I am trying to calculate live/dynamic totals of approval per week but I would like to see only for 2-3 weeks from today date and 2-3 weeks from the last approval date from the data model.
The data model goes from 18/01/2021 to 08/02/2021 (weekly).
Going back 2 weeks from last approval date from data model I tried to use this:
Trial 1 = CALCULATE([Approvals],
FILTER(ALL(‘Date’),
SELECTEDVALUE(‘Date’[Date]) >= MAX(Data[Approval]) - 14 &&
SELECTEDVALUE(‘Date’[Date]) >= MAX(Data[Approval])))
but unfortunately, I get the wrong result.
Then I applied different method using:
Trial 2 =
VAR currentdate = SELECTEDVALUE(‘Date’[Date])
Return
IF(currentdate >= MAX(Data[Approval]) - 14 && currentdate <= MAX(Data[Approval]), [Approvals], 0)
But again the formula did not work 100% correctly as it returned the results for week 4-2021.
I thought I can apply today into the formula as I would like to calculate number of approvals per week going back 2 weeks back from today date:
Trial 3 =
IF(SELECTEDVALUE(‘Date’[Date]) >= TODAY() -14 && SELECTEDVALUE(‘Date’[Date]) <= TODAY(),
[Approvals], 0)
Trail 4 =
CALCULATE([Approvals],
FILTER(ALL(‘Date’),
SELECTEDVALUE(Data[Date]) >= TODAY() -14 && SELECTEDVALUE(Data[Date]) <= TODAY()))
Could you please advise/ help?
I will appreciate your help,
Thank you,
Mateusz