Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Creating a Date column or measure with two existing columns, Month (Text) and Year (Text) formats

I need a date column for Chart visualizations to show month/year, current year vs prior year, but my columns are month (which is text and the month number, 1,2,3, etc.) and year (which is text).  How...
  • sevenhills's avatar
    4 years ago

    Dax for the column YYYY-MM:

     

    YYYY-MM = 'Table'[YYYY] & "-" & Right("00" & 'Table'[MM], 2)

     

     

    YYYY ~ Number, MM ~ Text 

     

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    I think sevenhills 's method is the most convenient and it has solved your issue,so please kindly Accept his reply as the solution. More people will benefit from it. 

     

    You could also try:

    YYYY-MM = FORMAT(CONVERT(COMBINEVALUES(" ",[Year],[Month Number],"1") ,DATETIME),"YYYY-MM")

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.