Forum Discussion

vibhoryadav23's avatar
vibhoryadav23
Icon for Helper II rankHelper II
4 years ago
Solved

How to crosstab a table in DAX?

Hi,  I am trying to transpose/crosstab/pivot a table directly in Dax. Is it possible? Input Table User Product Status A Prod 1 Active A Prod 2 Inactive B Prod 1 Others B Pr...
  • PaulDBrown's avatar
    PaulDBrown
    4 years ago

    Use:

    New Table =
    ADDCOLUMNS (
        VALUES ( 'Table'[User] ),
        "Prod1", CALCULATE ( MAX ( 'Table'[Status] ), 'Table'[Product] = "Prod 1" ),
        "Prod2", CALCULATE ( MAX ( 'Table'[Status] ), 'Table'[Product] = "Prod 2" )
    )