Forum Discussion

alexbjorlig's avatar
alexbjorlig
Icon for Helper IV rankHelper IV
4 years ago
Solved

How 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...
  • Fowmy's avatar
    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 )