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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.