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,
I'm trying to only show the line that has the most recent RoleLastUpdate (see Image) for each distinct RoleID..
I've tried this solution, however this only shows the most recent date for the whole table.
Solved: Filtering table for rows showing the max date per ... - Microsoft Fabric Community
This solution is supposed to put a '1' next to the latest date, which can then be filtered on, however it's putting a one next to every date (image - last column). I've checked the example from the solution and mine looks the same, aside from the table/column names.
Solved: How to Filter a Table To Show Only Most Recent Dat... - Microsoft Fabric Community
The only filter I have on is for specific users, which shouldn't effect results as they're grouped by RoleID, and in this case the same user is attached to each.
DAX used.
hi @PartyFish88
Can you please try this measure, I just typed it in notepad, please check syntax.
Measure =
VAR _RoleLastUpdate = SELECTEDVALUE('Legal IR35RoleReview'[RoleLastUpdate])
VAR _RoleID = SELECTEDVALUE('Legal IR35RoleReview'[RoleID])
VAR maxdate =
CALCULATE(
MAX ('Legal IR35RoleReview'[RoleLastUpdate]),
REMOVEFILTERS('Legal IR35RoleReview'),
'Legal IR35RoleReview'[RoleID] = _RoleID
)
RETURN IF( _RoleLastUpdate = maxdate, 1, BLANK() )
Hi @talespin
Thank you for your solution, unfortunately it's putting a '1' next to each entry rather than those with the most recent dates (see image).
hi @PartyFish88
In the visual, are all attributes from same table?
If possible please share pbix file with all sensitive data removed(or with mockup data).
Hi @PartyFish88 ,
As lbendlin said, using the REMOVEFILTERS function is a viable approach. Below is my answer.
It seems you’re on the right track with your DAX formula, but there’s a small adjustment needed to achieve the desired result.
Here’s the revised DAX measure:
MostRecentUpdateFilter2.0 =
VAR maxdate =
CALCULATE(
MAX('Legal IR35RoleReview'[RoleLastUpdate]),
ALLSELECTED('Legal IR35RoleReview')
)
RETURN
IF(
'Legal IR35RoleReview'[RoleLastUpdate] = maxdate,
1,
BLANK()
)
By doing so, we’re now comparing the date for each row against the maximum date across all rows, regardless of the specific RoleID. This should correctly mark only the most recent date with a ‘1’ in your result.
Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous @lbendlin
I've tried both of your solutions, unfortunately they only bring back the most recent RoleUpdate (last night).
I need to bring in the most recent Role update for each unique RoleID 🤔
In your version 4.0 what's the purpose of the VALUES filter?
The VALUES filter is supposed to group events/updates together by their RoleID, this being a unique identifier. The rest of the DAX is supposed to put a '1' next to the most recent RoleLastUpdate which can then be filtered on, showing only the most recent RoleUpdate for each RoleID 🙂
I say supposed to, DAX isn't really my fortay . . . yet 😅
Instead of ALLSELECTED use REMOVEFILTERS on the date column.
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |