Forum Discussion

kamil947's avatar
kamil947
Frequent Visitor
4 years ago
Solved

Sum by Individual Selection and Sum by Group

Hello,   I'm trying to show a dash that is built on the food slicer. Once the food is selected, I'd like to display the amount of that specific food and the amount in the specific group. For exampl...
  • TheoC's avatar
    4 years ago

    @kamil947, apologies. I misread the part that you wanted the "Sum of Group" in the other Card. 

     

    Although @Kevin_Harper has provided a very good output in terms of Calculated Columns, there is a challenge with using this for the output as evident below.  The total of the Calculated Column totals the amounts at the row level and therefore can overstate the actual output.  

     

    I recommend using a Measure as per below which provides the total amount of 26 when nothing is selected but also achieves the group subtotal in the Card visual itself.

     

     

     

     

    The Measure is as follows:

    Measure = 
    
        SUMX ( 
            VALUES ( tableFood[Group] ) , 
            CALCULATE ( SUM ( tableFood[Amount] ) , ALLEXCEPT ( 'tableFood' , tableFood[Group] ) )
            )

     

    All the best.