Forum Discussion
FilipK
Resolver I
5 years agoGet last value in group
Hey, assume you've got this dataset: time deviceId Version 7/29/2021 1 A 7/30/2021 1 A 7/31/2021 2 A 8/1/2021 2 A 8/2/2021 3 C 8/3/2021 1 B 8/4/2021 2 A ...
- 5 years ago
FilipK This will return your first desired table:
Table 2 = VAR __Table = SUMMARIZE('Table (5)',[deviceId],"__time",MAX('Table (5)'[time])) VAR __Table2 = ADDCOLUMNS(__Table,"__Version",MAXX(FILTER('Table (5)','Table (5)'[deviceId] = [deviceId] && [time] = [__time]),[Version])) RETURN __Table2You can use this in a measure like the following:
Measure = VAR __Version = MAX([Version]) VAR __Table = SUMMARIZE(ALL('Table (5)'),[deviceId],"__time",MAX('Table (5)'[time])) VAR __Table2 = ADDCOLUMNS(__Table,"__Version",MAXX(FILTER('Table (5)','Table (5)'[deviceId] = [deviceId] && [time] = [__time]),[Version])) RETURN COUNTROWS(FILTER(__Table2,[__Version] = __Version)) + 0This would be used in a pie chart along with your [Version] column for example.
- 5 years ago
- 5 years ago
Ashish_Mathur
Super User
5 years ago