Forum Discussion

kodnil2020's avatar
kodnil2020
Helper I
6 years ago
Solved

Create Clustered column Chart

Hello,    I am new to Power BI and still needs to learn few things. Appreciate your help here.  I have 2 tables: Table 1:  Employee Grades with Department Table 2:  Active/Inactive employees   ...
  • v-zhenbw-msft's avatar
    v-zhenbw-msft
    6 years ago

    Hi kodnil2020 ,

     

    We can create a column and a matrix table to meet your requirement.

     

    1. Create a calculate column to sort Grade.

     

    Legend = 
    SWITCH(
        TRUE(),
        CONTAINSSTRING('Table 1'[Grade],"A"),"A",
        CONTAINSSTRING('Table 1'[Grade],"B"),"B",
        CONTAINSSTRING('Table 1'[Grade],"C"),"C","D & Above")

     

     

    Then we can create a measure and put the column to legend in Clustered Column Chart.

     

    Measure = 
    var _x = CALCULATE(DISTINCTCOUNT('Table 1'[ID]),FILTER('Table 2','Table 2'[Active]=1))
    var _y = CALCULATE(DISTINCTCOUNT('Table 1'[ID]),FILTER(ALLSELECTED('Table 2'),'Table 2'[Active]=1),FILTER(ALLSELECTED('Table 1'),'Table 1'[Department]=MAX('Table 1'[Department])))
    return
    DIVIDE(_x,_y)

     

     

    If you have any question, please kindly ask here and we will try to resolve it.

     

    Best regards,

     

    Community Support Team _ zhenbw

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

     

    BTW, pbix as attached.