Forum Discussion

DrewCarousel's avatar
DrewCarousel
Frequent Visitor
4 years ago
Solved

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!

  • Anonymous's avatar
    Anonymous
    4 years ago

    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:

     

    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

2 Replies

  • Anonymous's avatar
    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:

     

    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