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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
DrewCarousel
Frequent Visitor

Adding date and time fields in formula

Dear community,

 

I have a complicated if and else formulated column where one of the ifs says:

 

... else if column A <> null then Column B + Column C else...

 

where column B is a date time field and column C is a time field. 

I have tried various solutions found online but none of them seem to have worked (using +, using &" "& and then formatting the column, using date(...)&time(...) )

 

Help please!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @DrewCarousel ,

You can consider using Dax to achieve:

Here are the steps you can follow:

1. Create measure.

Measure =
 IF(
    MAX('Table'[ColumnA]) <> BLANK(),FORMAT(MAX('Table'[ColumnB]),"yyyy-mm-dd"),FORMAT(MAX('Table'[ColumnC]),"hh:nn:ss AMPM"))

2. Result:

vyangliumsft_0-1639449285812.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi  @DrewCarousel ,

You can consider using Dax to achieve:

Here are the steps you can follow:

1. Create measure.

Measure =
 IF(
    MAX('Table'[ColumnA]) <> BLANK(),FORMAT(MAX('Table'[ColumnB]),"yyyy-mm-dd"),FORMAT(MAX('Table'[ColumnC]),"hh:nn:ss AMPM"))

2. Result:

vyangliumsft_0-1639449285812.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

bcdobbs
Community Champion
Community Champion

You could pass the year, month, day, hours, minutes etc into:

DATE(2015,1,9) + TIME(2,30,0)

 

Since August 2021 you can use string literals but wonder if you're using an old version?

https://docs.microsoft.com/en-us/dax/dax-syntax-reference#date-and-time

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.