Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello everyone,
I have a problem with my table. I want to be able to show only the latest result based on the version. The version always changes depending on my visual filter. The LastModified is a real column in my dataset and the LatestResult is a measure to calculate the latest result dynamically. So far so good. The table looks somewhat like the following:
ID | Version | Result | LastModified | LatestResult |
1 | 23.5 | Pass | 23.11.2021 | 25.11.2021 |
1 | 23.6 | Failed | 25.11.2021 | 25.11.2021 |
2 | 23.5 | Pass | 23.11.2021 | 23.11.2021 |
3 | 23.5 | Pass | 23.11.2021 | 30.11.2021 |
3 | 23.6 | Pass | 25.11.2021 | 30.11.2021 |
3 | 24 | Pass | 30.11.2021 | 30.11.2021 |
4 | 23.7 | Failed | 27.11.2021 | 27.11.2021 |
Now I need to change that LatestResult measure so it gives TRUE/FALSE or 0/1, IF(LastModified = LatestResult).
The measure looks like this:
Solved! Go to Solution.
@Anonymous , Try a new measure or a new column
measure =
var _1 = calculate(Lastnonblankvalue(Table[LastModified], max(Table[Version])), filter(allselected(Table), Table[ID] = max(Table[ID])))
return
if( max(Table[Version]) =_1, true(), false())
new column =
var _1 = maxx(filter(Table, [ID] = earlier([ID]) ), [LastModified])
var _2 = maxx(filter(Table, [ID] = earlier([ID]) && LastModified] = _1 ), [Version])
return
if( (Table[Version]) =_2, true(), false())
@Anonymous , Try a measure like
measure =
var _1 = calculate(Lastnonblankvalue(Table[LastModified], max(Table[Version])), filter(allselected(Table), Table[ID] = max(Table[ID])))
return
calculate(Max(Table[Result]), filter( allselected(Table), Table[ID] = max(Table[ID]) && Table[Version] =_1))
@amitchandak Thanks for your reply.
This measure is now returning the Result for every ID. But I want to have an indicator like TRUE/FALSE or 0/1 if it is the last result or not. So your measure gives me results like this:
ID | Version | Result | LastModified | LatestResult | measure |
1 | 23.5 | Pass | 23.11.2021 | 25.11.2021 | Failed |
1 | 23.6 | Failed | 25.11.2021 | 25.11.2021 | Failed |
2 | 23.5 | Pass | 23.11.2021 | 23.11.2021 | Pass |
3 | 23.5 | Pass | 23.11.2021 | 30.11.2021 | Pass |
3 | 23.6 | Pass | 25.11.2021 | 30.11.2021 | Pass |
3 | 24 | Pass | 30.11.2021 | 30.11.2021 | Pass |
4 | 23.7 | Failed | 27.11.2021 | 27.11.2021 | Failed |
What I want to achieve is something like this:
ID | Version | Result | LastModified | LatestResult | measure |
1 | 23.5 | Pass | 23.11.2021 | 25.11.2021 | False |
1 | 23.6 | Failed | 25.11.2021 | 25.11.2021 | True |
2 | 23.5 | Pass | 23.11.2021 | 23.11.2021 | True |
3 | 23.5 | Pass | 23.11.2021 | 30.11.2021 | False |
3 | 23.6 | Pass | 25.11.2021 | 30.11.2021 | False |
3 | 24 | Pass | 30.11.2021 | 30.11.2021 | True |
4 | 23.7 | Failed | 27.11.2021 | 27.11.2021 | True |
If I could achieve this, than I could filter after only TRUE and get only latest result dynamically.
Any idea how to do that? Thanks @amitchandak
@Anonymous , Try a new measure or a new column
measure =
var _1 = calculate(Lastnonblankvalue(Table[LastModified], max(Table[Version])), filter(allselected(Table), Table[ID] = max(Table[ID])))
return
if( max(Table[Version]) =_1, true(), false())
new column =
var _1 = maxx(filter(Table, [ID] = earlier([ID]) ), [LastModified])
var _2 = maxx(filter(Table, [ID] = earlier([ID]) && LastModified] = _1 ), [Version])
return
if( (Table[Version]) =_2, true(), false())
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
60 |
User | Count |
---|---|
150 | |
115 | |
104 | |
89 | |
65 |