Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
zettipasta
Regular Visitor

Duplicates from a 4-hour interval w/ different datetime

Hello everyone! I have asked the same type of question but I can't figure out how to tweak the DAX function wherein the ID from a previous datetime will be tagged as HOLD if it enters today's datetime.

 

zettipasta_1-1666657997517.png

 

This previous discussion is for your reference: How to get duplicates from a 4 -hour interval - Microsoft Power BI Community

2 REPLIES 2
amitchandak
Super User
Super User

@zettipasta , I think you need additional date column for that

 

date = datevalue([Datetime])

 

New column =

var _time = [DateTime] -time(4,0,0)

var _cnt =countx(filter(Table, [ID] = earlier([ID]) && [DateTime]>= _time && [DateTime]< earlier([Datetime]) && [date] = earlier([date]) ), [ID])

var _cntall =countx(filter(Table, [ID] = earlier([ID]) && [DateTime]< earlier([Datetime]) && [date] = earlier([date])  ), [ID])

return

Switch(True(),

not(isblank(_cnt)), "Hold",

isblank(_cnt) && not(isblank(_cntall)), "Release",

"Hold"

)

 

If the old one is helping, mark that as a solution.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I did add an additional column for the date, but the output that I desire is that when the same id e.g., ID 1 from 10/24 at 8pm enters the latest datetime, it would still be tagged as hold

zettipasta_0-1666677483713.png

Although the 4-hour interval works, it doesn't count for across dates but only for the current datetime.. The ID is released at 12am when it should still subtract the hour, making it at 8pm, still tagging it as hold. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.