Forum Discussion

nleuck_101's avatar
nleuck_101
Icon for Continued Contributor rankContinued Contributor
4 years ago
Solved

Total Employee Count by group

Hello All,

 

I'm trying to calculate calculate total employee count by group so I can get the % of the Grand Total (ex. level 10 employee count is 100 and total employee count is 350 so the % should be 28.57). Currently though when I try to sum it sums all the numbers (ex. level 10 employee count 100 + 100 + 100 which is 300). This would give me a % of 85.71, this is incorrect.

Any ideas on how to get this to work.

 

 

  • tamerj1's avatar
    tamerj1
    4 years ago

    nleuck_101 
    Please try this measure

    Count Measure =
    VAR T1 =
        SUMMARIZE (
            TableName,
            TableName[Level],
            "@Count", SUMX ( VALUES ( TableName[Count] ), TableName[Count] )
        )
    RETURN
        SUMX ( T1, [@Count] )

14 Replies

  • nleuck_101's avatar
    nleuck_101
    Icon for Continued Contributor rankContinued Contributor

    sharpie_dog 

     

    It's not that easy. The top part is the desired results but the bottom part it what I'm actually getting.

     

     

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi nleuck_101 

    Please use 

    New Table =
    VAR T1 =
        SUMMARIZE ( TableName, TableName[Level], "@Count", MAX ( TableName[Count] ) )
    RETURN
        ADDCOLUMNS ( T1, "% Count", DIVIDE ( [@Count], SUMX ( T1, [@Count] ) ) )
    • nleuck_101's avatar
      nleuck_101
      Icon for Continued Contributor rankContinued Contributor

      tamerj1 

       

      That only get's me the % of grand total. I still need to display the correct employee count in the visual.

  • sharpie_dog's avatar
    sharpie_dog
    Regular Visitor

    What I have seen is if the the "total" is summed up as a calculation in PBI, then you can right click to select the % versus doing a calculation to get the %; if that makes sense.