Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.
User | Count |
---|---|
15 | |
15 | |
11 | |
10 | |
10 |