Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Disclaimer: I know there are several similar topics here, but neither of them has correct answer, so here goes another try.
Data is a typical sequential log file that represents status changes for a set of entities over time - similar to this:
| DateTime | Key | Status |
| 2022-10-22 7:03 | A | New |
| 2022-11-01 3:00 | B | New |
| 2022-11-02 11:01 | A | Approved |
| 2022-11-02 17:00 | A | Cancelled |
| 2022-11-03 8:00 | A | Revised |
| 2022-11-04 7:00 | B | Approved |
Notes (this is important since usually suggested solutions do not work as they use wrong assumptions):
What we want is to know key's current status as of any given date (EoD of this given date to be precise). For the example dataset above, this would be:
| Date | A | B |
| 2022-10-22 | New | (null) |
| 2022-10-23 | New | (null) |
| ... | ... | ... |
| 2022-11-01 | New | New |
| 2022-11-02 | Cancelled | New |
| 2022-11-03 | Revised | New |
| 2022-11-04 | Revised | Approved |
Can this be achieved with DAX measure?
Hi @DmitryKo
please try
=
MAXX (
CALCULATETABLE (
TOPN ( 'Table', 'Table'[DateTime], Asc ),
'Date'[Date] <= MAX ( 'Date'[Date] )
),
'Table'[Status]
)
This is even syntaxically incorrect
Typo mistake
=
MAXX (
CALCULATETABLE (
TOPN ( 1, 'Table', 'Table'[DateTime], Asc ),
'Date'[Date] <= MAX ( 'Date'[Date] )
),
'Table'[Status]
)
Yeah, I figured.
This returns incorrect results anyways.
See screenshot - source table vs. matrix with measure value
Yes you are right. Another mistake
=
MAXX (
CALCULATETABLE (
TOPN ( 1, 'Table', 'Table'[DateTime] ),
'Date'[Date] <= MAX ( 'Date'[Date] )
),
'Table'[Status]
)
This seem to work with DESC sort order in TOPN. Thank you!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 6 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |