Forum Discussion

Sab's avatar
Sab
Helper V
1 year ago
Solved

UNION returns strange dates

Hello!

 

I am a table with around 400k rows (Sales), and another table with 15k (sales Current Month). 

 

As you can see from the screenshot, the dates are normal in the first two tables, and when I use the UNION function, it is expected to have the same dates (combined from those two tables). But as you can see something strange happens and I get dates dating from 1899!

 

Any idea why is this happening? There are NO empty values in either date column!


Thank you@

 

  • thank you for your replies, I found the 'issue'!

     

    It was a column which for whatever reason was misplaced compared to the same column in the other table. 

     

    In Power Query they were properly ordered, but after loading one of them went off one position! I tried to reorder that column in Power Query by sending it to the beginning (in both tables), didn't work! I had to get rid of it and after that, the dates look fine. 


    Thanks again for your replies!

4 Replies

  • Hi Sab 

    I tested a similar setup on my end, and the UNION function worked correctly without any date issues. If you're still experiencing strange dates, I recommend checking the data types of both columns in Power Query to ensure they’re explicitly set as Date/Time. Sometimes, mismatches in data types can cause unexpected results in DAX functions.

    If everything seems correct with the data types and the issue persists, try refreshing the query or clearing any applied transformations that might impact the date format.

     

    The pbix with the test is attached

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

  • Uzi2019's avatar
    Uzi2019
    Community Champion

    Hi Sab 

     

    Try to set both the date column to some different format. make sure it is date filed. and then craete new table and write your union dax fucntion. 

    It will work.

     

    I hope I answered your question!

     

     

  • thank you for your replies, I found the 'issue'!

     

    It was a column which for whatever reason was misplaced compared to the same column in the other table. 

     

    In Power Query they were properly ordered, but after loading one of them went off one position! I tried to reorder that column in Power Query by sending it to the beginning (in both tables), didn't work! I had to get rid of it and after that, the dates look fine. 


    Thanks again for your replies!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Sab ,

     

    Did your problem has been solved? If so, please mark it as the correct solution, and point out if the problem persists.

     

    Best regards,

    Adamk Kong