Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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 | Prod 2 | Active |
C | Prod 1 | Idle |
D | Prod 2 | Active |
Output table
User | Prod 1 | Prod 2 |
A | Active | Inactive |
B | Others | Active |
C | Idle | |
D | Active |
Thanks in advance!
Solved! Go to Solution.
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" )
)
Proud to be a Super User!
Paul on Linkedin.
@vibhoryadav23 , Use matrix visual, User on Row, product on column and max of status as value
@amitchandak Thanks for the suggestion and I have already done that but I need a ned table with this format as well.
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" )
)
Proud to be a Super User!
Paul on Linkedin.
User | Count |
---|---|
102 | |
91 | |
87 | |
79 | |
71 |
User | Count |
---|---|
113 | |
105 | |
101 | |
73 | |
65 |