Forum Discussion
Filtering last day with data
Anonymous , Try like this. Not sure if _monday logic is working
last_day_with_data =
var _max = maxx(allselected('Table'), 'Table'[date])
var _min = maxx(filter('Table', 'Table'[Date] <_max), 'Table'[Date])
var _min2 = maxx(filter('Table', 'Table'[Date] <_min), 'Table'[Date]) //use _min2 and _min if needed
return
VAR _yesterday = CALCULATE(
SUM('Table'[value]),
FILTER ('Table',
DATEVALUE ('Table'[Date]) = _max ))
VAR _daybefore = CALCULATE(
SUM('Table'[value]),
FILTER ('Table',
DATEVALUE ('Table'[Date]) = _min))
VAR _monday = [weekday_measure] = "maanantai"
RETURN
IF(_monday, _daybefore, _yesterday)
Hi,
Thanks amitchandak. I expressed myself poorly. I need to show data from yesterday (on every other day than Monday) or the day before (on Mondays) even though there would be data from the ongoing day also. Your solution is showing data from today.
Julia