Forum Discussion
alexbjorlig
Helper IV
4 years agoHow to filter table with latest day, dynamically?
Hi everyone. Still trying to understand the basics of CALCULATE and filter context. This problem is really hard for me to solve, so looking forward to your input/solutions. My objective is to bu...
- 4 years ago
alexbjorlig
You have built the correct logic but you don't need to iterate over the fact table.
I modified your measure:Latest = VAR __category = MAX('fact'[category]) VAR __maxdate = CALCULATE( MAX('fact'[date] ) , ALLSELECTED('fact' ) , 'fact'[category] = __category ) return INT ( max('fact'[date]) = __maxdate )
Fowmy
Super User
4 years agoalexbjorlig
You have built the correct logic but you don't need to iterate over the fact table.
I modified your measure:
Latest =
VAR __category = MAX('fact'[category])
VAR __maxdate = CALCULATE( MAX('fact'[date] ) , ALLSELECTED('fact' ) , 'fact'[category] = __category )
return
INT ( max('fact'[date]) = __maxdate )
alexbjorlig
Helper IV
4 years agoThanks man - amazing when the solution turn out to be more simple than expected š