Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Power BI - Switch values to column

Hello all, I would like to do the change below:

I have the data in Power BI from the left and would like to have a visualization on the right.
To precise the data like 2106 are words, not number. Also for some items on my list, I don't have ""Gate 2" so it will be NA.


I checked alreay online but couldn't find solutions...

 

Can you please help me?

  • Hi, Anonymous ;

    We could create a new table by dax.

    Table 2 = 
    var _a=SUMMARIZE(FILTER('Table',[Gate1]<>BLANK()),[Gate1],[Title],"Gate","Gate1")
    var _b= SUMMARIZE(FILTER('Table',[Gate2]<>BLANK()),[Gate2],[Title],"Gate","Gate2")
    var _c= EXCEPT(SUMMARIZE( SUMMARIZE( GENERATESERIES(2102,2112,1),[Value],"1",FORMAT([Value],"0")),[1]),UNION(VALUES('Table'[Gate1]),VALUES('Table'[Gate2])))
    return UNION(_a,_b, SUMMARIZE( _c,[1],"Title",BLANK(),"Gate",BLANK()))

    Then create a index column.

    Index = RANKX(ALL('Table 2'),[Title])

    Put it into matrix then aujust it.

    steped layout ->off; wrap-> off;icon-> off;

    The final output is shown below:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

1 Reply

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Icon for Community Support rankCommunity Support

    Hi, Anonymous ;

    We could create a new table by dax.

    Table 2 = 
    var _a=SUMMARIZE(FILTER('Table',[Gate1]<>BLANK()),[Gate1],[Title],"Gate","Gate1")
    var _b= SUMMARIZE(FILTER('Table',[Gate2]<>BLANK()),[Gate2],[Title],"Gate","Gate2")
    var _c= EXCEPT(SUMMARIZE( SUMMARIZE( GENERATESERIES(2102,2112,1),[Value],"1",FORMAT([Value],"0")),[1]),UNION(VALUES('Table'[Gate1]),VALUES('Table'[Gate2])))
    return UNION(_a,_b, SUMMARIZE( _c,[1],"Title",BLANK(),"Gate",BLANK()))

    Then create a index column.

    Index = RANKX(ALL('Table 2'),[Title])

    Put it into matrix then aujust it.

    steped layout ->off; wrap-> off;icon-> off;

    The final output is shown below:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.