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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
NaderSaeed
Helper II
Helper II

Start the Day from 7AM to 7AM

I want a conditional column that start the day from 7AM to 7AM instead of 0:00 to 0:00

For exmaple, for the below data,

NaderSaeed_0-1618853462030.png

How can I write the function to return this in a calcualted column?

Thank you 🙂

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@NaderSaeed , Try a new column like

Switch( true() ,
[Start Time] >= date([Start Time]) + time(7,0,0) && [Start Time] < date([Start Time])+1 + time(7,0,0) ,date([Start Time]) ,
[Start Time] <= date([Start Time]) + time(7,0,0), date([Start Time]) -1,
date([Start Time]) +1
)

View solution in original post

5 REPLIES 5
NaderSaeed
Helper II
Helper II

Hi @amitchandak 

 

I'm getting this error when I refer to the Start Time Column inside the date function.

Too few arguments were passed to the DATE function. The minimum argument count for the function is 3.

amitchandak
Super User
Super User

@NaderSaeed , Try a new column like

Switch( true() ,
[Start Time] >= date([Start Time]) + time(7,0,0) && [Start Time] < date([Start Time])+1 + time(7,0,0) ,date([Start Time]) ,
[Start Time] <= date([Start Time]) + time(7,0,0), date([Start Time]) -1,
date([Start Time]) +1
)

Hello, 

 

Ive tried this formula with my date column

 

SWITCH( true() ,
[OccurrenceTimeStamp] >= date([OccurrenceTimeStamp]) + time(7,0,0) & [OccurrenceTimeStamp] < date([[OccurrenceTimeStamp]])+1 + time(2,59,0) ,date([OccurrenceTimeStamp]) ,
[[OccurrenceTimeStamp]] <= date([OccurrenceTimeStamp]) + time(3,0,0), date([OccurrenceTimeStamp]) -1,
date([OccurrenceTimeStamp]) +1
)

(trying to do 2:59 AM - 3:00AM as one day)

but am getting this error when I hit apply:

 

amandabus21_0-1663024464361.png

 

do you have any suggestions?

 

Hello SuperUser,

This works like a charm.

Any idea how to get month starting on the last day of prevouis month till this month less 1 day?

Example month starts on 31/03/2021 & ends 29/04/2021.

 

Thanks Stephen

 

It worked for me after changing the Date function to Datevalue function.

 

Thank you so much. 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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