Home > other >  Date (Month/Year) Based on Number in another Column
Date (Month/Year) Based on Number in another Column

Time:07-27

I have a column in powerbi that repeats the numbers 1-12, and I would like another column to display a date (month and year) based on that number, such that 1 always corresponds to the current month/year, two would be next month, etc. like this:

Index | Date 1 | July 2022 2 | August 2022 3 | September 2022

and on August 1, it would change to:

Index | Date 1 | August 2022 2 | September 2022 3 | October 2022

CodePudding user response:

You can use this formula in a calculated column:

Date 1 = 
FORMAT( 
    DATE( 
        YEAR(NOW()), 
        MONTH(NOW())   'Table'[Index], 
        1
    ), 
    "mmmm yyyy"
)
  • Related