Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Adding dates to existing rows in table

I currently have a table with the following: ID Category Failure Rate 1 A 0.5 2 B 0.2 3 C 0.1   I need to add a date range of month-year for each...
  • v-lili6-msft's avatar
    v-lili6-msft
    7 years ago

    hi, Anonymous 

    If so, try this formula

    Table= var _datetable=FILTER(CALENDAR("2017-01-01","2017-12-31"),DAY([Date])=1) return
    
    GENERATE(Basic,SELECTCOLUMNS(_datetable,"Mon-year",FORMAT([Date],"MMM-YYYY")))

    https://docs.microsoft.com/en-us/dax/pre-defined-date-and-time-formats-for-the-format-function

    If so, [Mon-year] is a text type, ("Jan-2017" not a date format).

    I would suggest you use above formula to create the table and change the format in modeling. In this case, it still the date type.

     

     

    Best Regards,

    Lin