Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

I'm trying to convert eight digit yyyymmdd to date format with DAX function.

column = DATE(LEFT(TABLE[COLUMN],4),MID(TABLE[COLUMN],5,2),RIGHT(TABLE[COLUMN],2))

However, I've got an error because of the original column has some records with "00000000", so how can I make a default value with IF statement or are there any better solutions?

Best regards 

1 Answer

0 votes
by (47.2k points)

column = IFERROR( DATE(LEFT(TABLE[COLUMN],4),MID(TABLE[COLUMN],5,2),RIGHT(TABLE[COLUMN],2)), DATE(yyyy,mm,dd))

Want to become a Business Analyst? Then have a look at Power BI certification from Intellipaat! 

Browse Categories

...