Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vibhoryadav23
Helper II
Helper II

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

UserProductStatus
AProd 1Active
AProd 2Inactive
BProd 1Others
BProd 2Active
CProd 1Idle
DProd 2Active

 

Output table

UserProd 1Prod 2
AActiveInactive
BOthersActive
CIdle 
D Active

 

Thanks in advance!

1 ACCEPTED 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" )
)

 

New table.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@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" )
)

 

New table.png

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.