The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone!
I would like to determine the last tracked status within a specific systematic.
So, I have this table:
Date Requested | Item | Type1 | Type2 | Value | State | Date Finished | Order |
01.01.2020 | AAA1 | 2 | AB | 500 | 95 | 100 | |
015.01.2020 | AAA2 | 6 | AC | 600 | 100 | 01.02.2020 | 101 |
Now I would like to determine the last state for each order where "Type1" = 6 and "Type2" = AC.
How would you build that measure?
Hi,
The below code should do the trick.
___GetLastState =
var _maxdate = CALCULATE(MAX('Table'[Date Requested]), FILTER(ALL('Table'), 'Table'[Item] = SELECTEDVALUE('Table'[Item]) && 'Table'[Type1] = 6 && 'Table'[Type2] = "AC" ))
return
CALCULATE(MAX('Table'[State]), FILTER(ALL('Table'), 'Table'[Item] = SELECTEDVALUE('Table'[Item]) && 'Table'[Date Requested] = _maxdate))
Link to the file here.
I recorded a video while creating the measure, hopefully, this helps in building an understanding of how to approach such a challenge.
Please accept as a solution if so. Thumbs up for the effort is appreciated.
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi, @joshua1990 , you may try this measure
Latest Status = MAXX( FILTER(SysLog, SysLog[Type1] = 6 && SysLog[Type2] = "AC"), SysLog[State] )
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
25 | |
13 | |
12 | |
8 | |
8 |