Forum Discussion
Find LatestResult dynamically: Measure showing too many values
- 4 years ago
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())
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())