Tuesday, 4 June 2019

Convert Date from Integer to Date in DAX




I have a dimension table that contains only the “YearMonth” key. Now my target is to create the first date for each YearMonth key. I simply get this by concatenating it with 01 and change the date type into Whole Number.

DateIntColumn = CONCATENATE('Month'[MonthKey],"01")





My next target is what the reason I’m writing this post. How I’m going to get the date type filed out from this date number. What I do is I simply break it to ‘yyyy,mm,dd’. Below is the DAX I have used.



Column = DATE(INT(LEFT([DateIntColumn],4)),INT(MID([DateIntColumn],5,2)),INT(RIGHT([DateIntColumn],2)))

No comments:

Post a Comment