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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bdoiron
Frequent Visitor

Crosstab Query

 

Hello all, I have a table that is unnormalized that I am trying to make a table visual from. Its values go across horizontal and I need them vertical. I can unpivot all the columns but that doesnt work. One column is a Safe count and the next is an At risk count. These counts pertain to one item say "Body position". This is what my table looks like

 

Body position Safe --- Body position At Risk ----- Slips Safe ----  Slip At Risk     and so on........   around 20 columns

          10                                  5                                    13                     7

 

I need it to look like this:                                         I can unpivot all and I get this:

 

Descr                         Safe    At Risk                      

Body position              10        5                                 Body position Safe           10

Slips                             13        7                                 Body position At Risk         5

  ***************                                                           Slips Safe                         13     

                                                                                    Slips At Risk                       7

 

  Thanks for any help !!!!!!!!!1!!!!1      

 

 

2 REPLIES 2
v-caliao-msft
Microsoft Employee
Microsoft Employee

@bdoiron,

 

I can unpivot all and I get this:
Body position Safe           10

Body position At Risk         5

Slips Safe                         13     

Slips At Risk                       7

 

If you can get this result, you can split the first column into two colums, and then use matrix visual to get your expected results.

Descr                         Status                   Count

Body position           Safe                        10

Body position           At Risk                    5

Slips                         Safe                         13     

Slips                         At Risk                      7

Capture.PNG

 

Regards,

Charlie Liao

 

Greg_Deckler
Community Champion
Community Champion

Select all of your columns, click "Transform" tab in Query Editor and then choose "Unpivot Columns". You will end up with Attribute Value pairs and then you could create measures to do the calculations regarding risk and safe.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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