Forum Discussion

BIswajit_Das's avatar
BIswajit_Das
Impactful Individual
2 years ago
Solved

Calculated Table

Hello Experts,
Need Guidance with the below structure

Table1 with data :

idpartyvalue
1B10845
2B22921
1I20921
5I5807
7I40044
9B24634
9I11967
14I869

 

The Required Result Table :

idBI
11084520921
222921 
5 5807
7 40044
92463411967
10  
14 869

Using Calculated table on Power BI desktop

Thanks & Regards....

  • sjoerdvn's avatar
    sjoerdvn
    2 years ago

    I don't think it is possible to do a pivot operation dynamically in dax; only in power query. At least I can not think of any way to achieve this.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi BIswajit_Das 

     

    sjoerdvn is right.

    DAX has a number of limitations, and if this is a calculated table, this is the only way to do it

    Or you can try to export the data from the calculated table and import it again to use power query. But it's going to be very complicated.

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi BIswajit_Das 

     

     

    Please try this:

    Click the Transform data in the Home pane:

    Copy the origin table and paste it:

          

    Select the party column and click the Pivot Column:

    The result is as follow:

    Finally, Close & Apply.

     

     

    Best Regards

    Zhengdong Xu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • sjoerdvn's avatar
    sjoerdvn
    Solution Sage
    Table2 = ADDCOLUMNS(VALUES(Table1[id])
        ,"B", CALCULATE(VALUES(Table1[value]),ALLEXCEPT(Table1,Table1[id]), Table1[party]="B")
        ,"I", CALCULATE(VALUES(Table1[value]),ALLEXCEPT(Table1,Table1[id]), Table1[party]="I")
    )
    • BIswajit_Das's avatar
      BIswajit_Das
      Impactful Individual

      Hello sjoerdvn 
      Thanks for responding
      Yeah we can do it this way
      But we  have mention column names each time
      Isn't there any other way to acheive this?

      • sjoerdvn's avatar
        sjoerdvn
        Solution Sage

        I don't think it is possible to do a pivot operation dynamically in dax; only in power query. At least I can not think of any way to achieve this.

  • BIswajit_Das's avatar
    BIswajit_Das
    Impactful Individual

    Hello Anonymous, Idrissshatila 

    Thanks for responses but as I mentioned above my table is a calculated table which is not gonna show in transform data section
    That's why I wonder if there's another way to do so..
    Thanks & Regards...