Forum Discussion

MHTANK's avatar
MHTANK
Icon for Helper III rankHelper III
4 years ago
Solved

Date

How to handle this date column? Some are dd-mm-yyyy format and some are mm-dd-yyyy format.   
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi  MHTANK ,

    You can click in Power BI Query, right click [StockDate] - Change Type - Date/Time.

    When the date is wrong, the wrong date will display Error.

    If Error is displayed, you can display the correct date by doing the following:

    In Power Query check [StockDate] - Split Column - By delimiter.

    Result:

    Create calculated column.

    Month =
    IF(
        'Sheet1'[StockDate.2]>=12,[StockDate.3],[StockDate.2])
    Day =
    IF(
        'Sheet1'[StockDate.2]<>[Month],[StockDate.2],[StockDate.3])
    Date =
    DATE(
        [StockDate.1],[Month],[Day])

    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.