Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Help with TOTAL SUM

Hello, everyone!

 

I have the table below:

MonthIDWeight
January110
January215
January320
February415
February520
February625
March720
March825
March930
TOTAL 180

 

I need to create a measure to get the TOTAL WEIGHT and it stills get the correctly result, even i filter the table.

For exemple, if i filter by month = January and ID = 1 and 2, i want a measure that can get the total sum.

 

Something like this (column TOTAL WEIGHT is the expected result that i need):

MonthIDWeightTOTAL WEIGHT
January11025
January21525
Total 2525

 

I've tried the measures below:

(CALCULATE(Weight, ALL(ID))
(CALCULATE(Weight, ALL(Month))
 
But none of those worked.
 
After that i will divide Weigth / TOTAL WEIGHT to get a percent.
 
I hope i was clear πŸ™‚
Please, somebody help me!
 
 
Thanks πŸ˜„
  • Hi Anonymous ,

     

    You may create measure like DAX below.

     

     

    TOTAL WEIGHT = CALCULATE(SUM(Table1[Weight]),ALLSELECTED(Table1))
    
    
    
    Percent = DIVIDE(SUM(Table1[Weight]), CALCULATE(SUM(Table1[Weight]) , ALLSELECTED(Table1)))
    
    
    or use the measure:
    
    Percent = DIVIDE(SUM(Table1[Weight]), [TOTAL WEIGHT])

     

     

     

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

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

3 Replies

  • Anonymous add a measure like this

     

    Total Weight = CALCULATE ( SUM ( Table[Weight] ), ALL ( Table ) ) 

     

    I would ❀ Kudos if my solution helped. πŸ‘‰ If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    ⚑Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.⚑

  • v-xicai's avatar
    v-xicai
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    You may create measure like DAX below.

     

     

    TOTAL WEIGHT = CALCULATE(SUM(Table1[Weight]),ALLSELECTED(Table1))
    
    
    
    Percent = DIVIDE(SUM(Table1[Weight]), CALCULATE(SUM(Table1[Weight]) , ALLSELECTED(Table1)))
    
    
    or use the measure:
    
    Percent = DIVIDE(SUM(Table1[Weight]), [TOTAL WEIGHT])

     

     

     

     

    Best Regards,

    Amy 

     

    Community Support Team _ Amy

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