Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello, I would like to create a calculate column to see the last country by an ID that would be calculated by a versioning.
Here is an example of what I would like to find:
Do you have any idea how to do this in DAX? Thanks in advance!
Solved! Go to Solution.
@Anonymous Try:
Last Country Column =
VAR __ID = [ID]
VAR __VersionMax = MAXX(FILTER('Table',[ID] = __ID),[Version])
VAR __Last = MAXX(FILTER('Table',[ID] = __ID && [Version] = __VersionMax),[Country])
RETURN
__Last
You could add a column like
Last Country =
SELECTCOLUMNS (
CALCULATETABLE (
TOPN ( 1, 'Table', 'Table'[Version] ),
ALLEXCEPT ( 'Table', 'Table'[ID] )
),
"@val", 'Table'[Country]
)
@Anonymous Try:
Last Country Column =
VAR __ID = [ID]
VAR __VersionMax = MAXX(FILTER('Table',[ID] = __ID),[Version])
VAR __Last = MAXX(FILTER('Table',[ID] = __ID && [Version] = __VersionMax),[Country])
RETURN
__Last
User | Count |
---|---|
57 | |
21 | |
19 | |
17 | |
16 |
User | Count |
---|---|
85 | |
80 | |
52 | |
37 | |
22 |