March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello community,
My problematic is straight forward I need to add DAX column. I have cirteria x, y and z. I can identify duplicate with this formula:
Duplicates count =
var x= Criteria
return
COUNTROWS(FILTER(Table,criteria = x)) this give me the number of duplicates (grouping).
Then for every duplicates I need to put a 1 to the most recent date of the grouping and a 0 to the oldest.
Is that even possible to do in DAX add Column?
Thanks for your help,
Mark Lovejoy
Solved! Go to Solution.
Hi!
You should be able to do something like this:
Most recent date =
VAR __IsDuplicate = //Checks if row has a duplicate. If all rows has duplicates, this is not needed.
If('Table'[Duplicates]>0,TRUE(),FALSE())
VAR __MaxDate = //Finds the most recent (MAX()) date for current criteria
CALCULATE(
max('Table'[Date]),
FILTER(all('Table'),'Table'[Criteria] = EARLIER('Table'[Criteria])
)
)
return
if(__IsDuplicate, //If current row is a duplicate
if('Table'[Date] = __MaxDate, //And current row date is the most recent date for this criteria
1, //return 1
0 //else return 0
),
0 else return 0
)
Hope this helps!
Hi @mlovejoy
please try
Result =
MAXX (
CALCULATETABLE ( 'Table', ALLEXCEPT ( 'Table', 'Table'[Criteria] ) ),
'Table'[Date]
)
Hi!
You should be able to do something like this:
Most recent date =
VAR __IsDuplicate = //Checks if row has a duplicate. If all rows has duplicates, this is not needed.
If('Table'[Duplicates]>0,TRUE(),FALSE())
VAR __MaxDate = //Finds the most recent (MAX()) date for current criteria
CALCULATE(
max('Table'[Date]),
FILTER(all('Table'),'Table'[Criteria] = EARLIER('Table'[Criteria])
)
)
return
if(__IsDuplicate, //If current row is a duplicate
if('Table'[Date] = __MaxDate, //And current row date is the most recent date for this criteria
1, //return 1
0 //else return 0
),
0 else return 0
)
Hope this helps!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
25 | |
18 | |
15 | |
9 | |
8 |
User | Count |
---|---|
37 | |
32 | |
18 | |
16 | |
13 |