Forum Discussion

Fahad5's avatar
Fahad5
Frequent Visitor
4 years ago
Solved

Calendar table issue

Please help me out with this, I'm unable to assing dates in formate, some are showing like 19/10/2020 some are 20212110.

  • Hi, Fahad5 

    According to your description, I can clearly understand your requirement, you want to unite the date column in your dataset to the Date type with the same format. I think you can first try to simply try to change the data type in the Power query to unite the date format like this:

     

    This method works for me.

    If you still have a problem, just try to create a calculated column in the Power BI like this, which can also help you to achieve this:

    Date1 =
    
    IF(ISERROR(value(MID([Date],3,1))),
    
    DATE(VALUE(RIGHT([Date],4)),VALUE(MID([Date],4,2)),VALUE(LEFT([Date],2))),
    
    DATE(VALUE(LEFT([Date],4)),VALUE(MID([Date],5,2)),VALUE(RIGHT([Date],2))))

     

    And you can get what you want.

    You can download my test pbix file below

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

2 Replies

  • v-robertq-msft's avatar
    v-robertq-msft
    Community Support

    Hi, Fahad5 

    According to your description, I can clearly understand your requirement, you want to unite the date column in your dataset to the Date type with the same format. I think you can first try to simply try to change the data type in the Power query to unite the date format like this:

     

    This method works for me.

    If you still have a problem, just try to create a calculated column in the Power BI like this, which can also help you to achieve this:

    Date1 =
    
    IF(ISERROR(value(MID([Date],3,1))),
    
    DATE(VALUE(RIGHT([Date],4)),VALUE(MID([Date],4,2)),VALUE(LEFT([Date],2))),
    
    DATE(VALUE(LEFT([Date],4)),VALUE(MID([Date],5,2)),VALUE(RIGHT([Date],2))))

     

    And you can get what you want.

    You can download my test pbix file below

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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