The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
This previous discussion is for your reference: How to get duplicates from a 4 -hour interval - Microsoft Power BI Community
@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.
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
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.
User | Count |
---|---|
15 | |
13 | |
9 | |
6 | |
6 |
User | Count |
---|---|
27 | |
19 | |
13 | |
9 | |
5 |