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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to merge 2 columns ( start date and end date ) with column of time using on if statement

Hello, 

 

I m having a trouble with merging dates and time based on conditions : i have 2 dates :

Start date and end dates, and i have many columns with time Format , i want to merge the columns using those conditions : 

If ( Column Time <= (00:00:00) and start date = end date then [Start Date]& " "&[TimeColumn] else [end date]& " "& [TimeColumn]

this is not working neither on calculated colmun nor on dax measure 

imane_12_0-1644483365697.pngimane_12_1-1644483431377.png

 

my final goal is to obtain for each timecolumn a merged column with the appropriate date (end date ==>if the time is equal or over 00:00:00 other wise merge with the start date!

 

If u have any ideas, i ve been blocked on this a week noww ! 😞 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please check the formula.

Column = IF(TableA[Column Time]<TIME(00,00,00)&&TableA[start date]=TableA[end date],TableA[start date]+TableA[Column Time],TableA[end date]+TableA[Column Time])

1.PNG

 

Best Regards,

Jay

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

 

Please check the formula.

Column = IF(TableA[Column Time]<TIME(00,00,00)&&TableA[start date]=TableA[end date],TableA[start date]+TableA[Column Time],TableA[end date]+TableA[Column Time])

1.PNG

 

Best Regards,

Jay

Anonymous
Not applicable

hello, 

 

i just tested another case and the condition is not working correctly i think : for this date since we re at 23h PM he should choose the date 06/01 and not the 07/01

imane_12_2-1644488061575.png

do u have an idea please how can i add more condition for midnight value ! 

 

thanks in advance ! 🙂 

 

Anonymous
Not applicable

on dax its working but i get weird dates instead of my dates values : 

imane_12_0-1644487352194.png

imane_12_1-1644487433795.png

 

amitchandak
Super User
Super User

@Anonymous ,

If you need in DAx

 

If ( [Column Time] <= time(0,0,0) && [start date] = [end date] , [Start Date]+ [TimeColumn] , [end date]+  [TimeColumn] )

 

in power Query

 

If  [Column Time] <= #time(0,0,0) and [start date] = [end date] then [Start Date]+ [TimeColumn] else [end date]+  [TimeColumn]

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
Anonymous
Not applicable

thank you, i just tried, i cannot apply + on date and time formats on powerquery 

imane_12_0-1644486721610.png

for the other values i got "null values" on my custom column 

imane_12_1-1644486779089.png

 

i dont know if there is another way to put condition on times and date in order to calculate the right duration because without merging the dates ( end and start) and times, the duration of 2 task between 23 PM and 1 AM is 22h instead of 2h ! 😞 

 

Anonymous
Not applicable

Instead of '+', try using '&'

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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