Forum Discussion

Mace's avatar
Mace
New Member
4 years ago
Solved

Represent multiple column values in separate columns instead of separate rows

Hello,

I'm new to PBI and this thing may be trivial.

When I make a table of data i have the situation as on the first picture (multiple rows for different values in the column)

and would want to have it as on the second picture (one row and multiple columns-predefined).

 

I've tried to use "New Group" but couldnt adjust it.

Mace

  • Hi Mace 

    Dax code, create 3 columns,

    test1 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="DIST"))>0,"DIST")
    test2 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="EMS"))>0,"EMS")
    test3 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="OEM"))>0,"OEM")

    result

     

    Best Regards,

    Community Support Team _Tang

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

8 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Mace ,

     

    You can create a column with below code:-

    channel_dist = if(table[channel]="DIST",table[channel])
    channel_ems = if(table[channel]="EMS",table[channel])
    channel_oem = if(table[channel]="OEM",table[channel])

     

    Thanks,

    Samarth

      • Samarth_18's avatar
        Samarth_18
        Community Champion

        Mace , In that case you can create a column in Edit query and remove unneccesary column after there.

  • v-xiaotang's avatar
    v-xiaotang
    Community Support

    Hi Mace 

    Dax code, create 3 columns,

    test1 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="DIST"))>0,"DIST")
    test2 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="EMS"))>0,"EMS")
    test3 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="OEM"))>0,"OEM")

    result

     

    Best Regards,

    Community Support Team _Tang

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