Forum Discussion

pradeept's avatar
pradeept
Resolver I
5 years ago
Solved

One vs Rest

Hi Community,   I have employee feedback data.  Dataset: EmpID, DeptID, Rating,.. There are 8 departments. Ratings (1,2,......,10) Scenario:  I want to create bar charts to compare the Average ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi pradeept ,

     

    Please follow these steps:

     

    1. Create a table for X-axis by entering data like this:

    2. Just need one measure:

    Expected output = 
    var _curr=CALCULATE(SUM('Table'[Rating]),ALLEXCEPT('Table','Table'[Department]))
    var _rest=CALCULATE(AVERAGE('Table'[Rating]),FILTER(ALL('Table'),'Table'[Department]<>MAX('Table'[Department])))
    
    return IF(MAX('X-axis'[Type])="Rest",_rest,IF(MAX('Table'[Department]) =MAX('X-axis'[Type]),_curr))

    The final output is shown below:

     

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