Forum Discussion

Hanuma_Srikiran's avatar
Hanuma_Srikiran
Frequent Visitor
8 years ago
Solved

Column Header names should contain current month dynamically

Hi all,

 

I have a dataset as given below

 

IDPREVIOUS MONTH SALESCURRENT MONTH SALES
A1234644555556
B4664455555555

 

and I have to create a table chart as the following 

 

IDSeptember SalesOctober sales
A1234644555556
B4664455555555

or month name should add to column header.

Any help will be appreciated.

Thanks in Advance.

  • Hanuma_Srikiran,

     

    You may use the following DAX to add a new table and then use the Matrix visual.

    Table2 =
    UNION (
        SELECTCOLUMNS (
            Table1,
            "ID", Table1[ID],
            "Attribute", DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ),
            "Value", Table1[PREVIOUS MONTH SALES]
        ),
        SELECTCOLUMNS (
            Table1,
            "ID", Table1[ID],
            "Attribute", DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 ),
            "Value", Table1[CURRENT MONTH SALES]
        )
    )
    

3 Replies

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Community Support

    Hanuma_Srikiran,

     

    You may use the following DAX to add a new table and then use the Matrix visual.

    Table2 =
    UNION (
        SELECTCOLUMNS (
            Table1,
            "ID", Table1[ID],
            "Attribute", DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ) - 1, 1 ),
            "Value", Table1[PREVIOUS MONTH SALES]
        ),
        SELECTCOLUMNS (
            Table1,
            "ID", Table1[ID],
            "Attribute", DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 ),
            "Value", Table1[CURRENT MONTH SALES]
        )
    )