Forum Discussion

jgiles's avatar
jgiles
Frequent Visitor
4 years ago
Solved

Percentage in clustered column chart visual

Hi, I have a clustered column chart visual and the percentage is calculating across the grand total.   I'm trying to create a measure or column to calculate the level % by year.  Example Level A is ...
  • AllisonKennedy's avatar
    4 years ago

    jgiles  I started working on this before HotChilli  replied and then got interrupted. Am coming back to it now, so to expand on what HotChilli  said, here's exactly how you can clear the filter on Level.

     

    You've selected the % of GT - which clears filters on Level AND Year. You only want a subtotal, so only want to clear the filter on Level. Using the ALL function in DAX in combo with CALCULATE we can do this: 

     

    % of all Levels Count =
    DIVIDE(SUM(LevelsSample[Count]), CALCULATE(SUM(LevelsSample[Count]), ALL(LevelsSample[Level])))

     

    '

     

    Sample file attached below signature. Thanks jgiles  for the easy to copy/paste sample data - you made it very easy to answer your question. 🙂 

     

     

  • AllisonKennedy's avatar
    AllisonKennedy
    4 years ago

    jgiles  That's an interesting one I haven't noticed, but it makes sense if my guess is right: My guess is that the column level is sorting by is actually applying the filter too, so you need to add 

    ALL(Table[LevelSortColumn]) 

    as a filter argument too and that should do the trick.