Josh Ng
Josh Ng

Reputation: 198

Custom Date Filter using custom column

How can I achieve the following?

I want to always filter for yesterday's date. BUT, if there is no date recorded for yesterday, then filter for friday and saturday instead.

Upvotes: 0

Views: 53

Answers (1)

msta42a
msta42a

Reputation: 3741

I think this should help you:

First -> check if the current day is Monday Second -> if so go back 3 days else go back 1 Third -> Sum based on range

SumGapSunday = 
var __isMonday = WEEKDAY(TODAY()) = 2 
var __MoveTo = if(__isMonday, TODAY()-3,TODAY()-1)
return
CALCULATE( sum(TableRol[val]), FILTER(TableRol, TableRol[Date] >= __MoveTo && TableRol[Date] < TODAY() ))

Upvotes: 1

Related Questions