Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

DAX: Pivot table with multiple values.

I have a table as below

 

Emp ID   |Managers  |Roles

ABUnit head
ACBiz HR
ADBiz HR
AEBiz HR
AFOps Controller
AGBiz HR Manager
AHBudget Approver

 

 

Using DAX how can we pivot this table as below output

 

Emp ID |Unit Head |Biz HR 1 |Biz HR 2 |Biz HR 3|Ops Controller |Biz HR Manager |Budget Appover

 

A          B                C             D             E             F                       G                         H

Any help please 

 

Mohan V

  • Anonymous's avatar
    Anonymous
    7 years ago

    AlB I got the solution buddy,

    To get the ranks i tried the below dax,

     

     

    And then i pivoted the table using below dax,

     

     

    The only issue with this workaround is, each time i have manually add the column for the n no of emp id's

     

    And i tried your dax, sorry, it didnt worked, the Ranks2 column is what the output in above image 

     

    Thanks,

    Mohan V

12 Replies

  • AlB's avatar
    AlB
    Community Champion

    Hi Anonymous

     

    I think you need to use the Pivot/Unpivot features in the query editor for that, rather than DAX

    • Anonymous's avatar
      Anonymous
      Not applicable

      AlB thanks for the reply.

       

      Well, thanks for the suggestion, but i cant use the power query,
      Because my data model is SSAS, sql server 2016 enterprise.

       

      • AlB's avatar
        AlB
        Community Champion

        Hi Anonymous

        What would the desired output be in your example if  A had as Budget Approvers H and J instead of only H?