Forum Discussion

RMDNA's avatar
RMDNA
Solution Sage
8 years ago
Solved

Create date columm from odd text format

Hi all,

 

I'm running into an issue trying to create a date from an odd format.

 

From the below table, we have Year, Week Num of Year, and Day of Week Num. I need to turn the first row into February 1, 2018 and increment from there.

 

I've created a custom column of Year&Week&Day in an attempt to make a Column From Example, but I can't get it to switch to 2/8/2018 once we increment to week 2.

 

Any assistance?

 

  • HI RMDNA

     

    Please give this calculated column a try

     

    Column = 
    VAR BaseDate = DATE(2018,2,1)
    RETURN 
        BaseDate + 
        ('Table 2'[DayOfWeekNum]-1) +
        ('Table 2'[WeekNum] * 7) - 7 

     

9 Replies

    • RMDNA's avatar
      RMDNA
      Solution Sage

      February 1 2018 was a Thursday.

      • Phil_Seamark's avatar
        Phil_Seamark
        Microsoft Employee

        Cool, how would I know that normally?  Can I hardcode that into the logic, or does the DAX need to work out other years too.

         

        How come you need to start from 1st Feb (and not 1st Jan?)... just curious