Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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! 

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...