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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Syndicate_Admin
Administrator
Administrator

Set actual date based on time

Hello good day.

I have a database where I have date, code, time of realization, etc..

BereniceMtz10_1-1628187144931.png

I'm doing a count of how many activities a person does per month in a company.

The problem is that according to the schedule is the date, that is, from 6:00 am to 5:59 am that activity if it belongs to that day, after 6:00 am it would enter the next day. Which is not a problem until the end of the month.

That is, if a person charges an activity on July 1 at 5:00 am or 5:59 am should not count it in July, but in June.

What formula would it have to occupy for the correct date to count? I was trying to test by making a calculated table.

with the following formula:

Real Date = IF('Historical Inspections'[Time] < "6:00 a.m.", 'Historical Inspections'[Date], 'Historical Inspections'[Date] -1)
but I get error by the date type and Text type values.
I don't think it would be right to do this, I hope you can help me.
Thank you
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Syndicate_Admin , make sure time is time datatype and then try

Real Date = IF('Historical Inspections'[Time] < time(6,0,0) , 'Historical Inspections'[Date], 'Historical Inspections'[Date] -1)

 

but I think this needs to be

 

Real Date = IF('Historical Inspections'[Time] >= time(6,0,0) , 'Historical Inspections'[Date], 'Historical Inspections'[Date] -1)

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

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Syndicate_Admin , make sure time is time datatype and then try

Real Date = IF('Historical Inspections'[Time] < time(6,0,0) , 'Historical Inspections'[Date], 'Historical Inspections'[Date] -1)

 

but I think this needs to be

 

Real Date = IF('Historical Inspections'[Time] >= time(6,0,0) , 'Historical Inspections'[Date], 'Historical Inspections'[Date] -1)

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors