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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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