Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
I have a table with a column of IDs with a start and end date for those IDs. I need a DAX formula that will identify duplicate IDs but only if the start and end dates overlap.
For example on a 3 column table with the ID, Start Date, End Date.
If the first 3 rows are ID 1.
The first row has a start date of Jan 1 2018 and an end date of jan 31st. 2nd row has start date of Feb 1 and end date of feb 28th. Thats ok and no duplicate would exist. However if the 3rd row in this example has a start date of Jan 15 and an end date of Jan 20 then it should flag this ID as a duplicate ID.
Example File
Solved! Go to Solution.
Hi,
This is the calculated column formula i wrote
=if(ISNUMBER(CALCULATE(MAX(Data[Start Date]),FILTER(Data,Data[ID]=EARLIER(Data[ID])&&Data[Start Date]<=EARLIER(Data[End Date])&&Data[Start Date]>EARLIER(Data[Start Date])))+CALCULATE(MIN(Data[End Date]),FILTER(Data,Data[ID]=EARLIER(Data[ID])&&Data[End Date]>=EARLIER(Data[Start Date])&&Data[End Date]<>EARLIER(Data[End Date])&&Data[Start Date]<=EARLIER(Data[End Date])))),"Duplicate","OK!")
Hope this helps.
Hi,
This is the calculated column formula i wrote
=if(ISNUMBER(CALCULATE(MAX(Data[Start Date]),FILTER(Data,Data[ID]=EARLIER(Data[ID])&&Data[Start Date]<=EARLIER(Data[End Date])&&Data[Start Date]>EARLIER(Data[Start Date])))+CALCULATE(MIN(Data[End Date]),FILTER(Data,Data[ID]=EARLIER(Data[ID])&&Data[End Date]>=EARLIER(Data[Start Date])&&Data[End Date]<>EARLIER(Data[End Date])&&Data[Start Date]<=EARLIER(Data[End Date])))),"Duplicate","OK!")
Hope this helps.
Thank you very much!
You are welcome.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
115 | |
112 | |
105 | |
95 | |
58 |
User | Count |
---|---|
174 | |
147 | |
136 | |
102 | |
82 |