Forum Discussion

FilipFireFlyBI's avatar
FilipFireFlyBI
Resolver I
7 years ago
Solved

sum rows with a condition

Hi all, See below a preview of my tabel. There are two categories (A and B), the sum of values is 34. Type,Value A, 20 A, 10 B, 4 Total, 34 I want to add Type B to Type A, in the weights of the values of the Types (so row 1 Type A = 20/30 and row 2 Type A = 10/30). So this is what I need: Type,Value A, 22.67 B, 11.33 Total, 34 As you can see total does not change (Total is 34 before and 34 after) I have already tried both Power Query (Grouping by etc.) and different DAX, but no answer. Any ideas? Thanks!
  • Hi FilipFireFlyBI ,

     

    I’m confused about your description. How do you calculate the values of 22.67 for A and 11.33 for B?  If you multiply the value of A by 34 and divide by 30, then how would your B equal 11.33?  is it correct?  The following is my sample data. Can you please share more details and post the accurate output. Then we can help you as soon as possible.

    Best Regards,

    Xue Ding 

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

     

3 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Community Support

    Hi FilipFireFlyBI ,

     

    I’m confused about your description. How do you calculate the values of 22.67 for A and 11.33 for B?  If you multiply the value of A by 34 and divide by 30, then how would your B equal 11.33?  is it correct?  The following is my sample data. Can you please share more details and post the accurate output. Then we can help you as soon as possible.

    Best Regards,

    Xue Ding 

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

     

    • vivran22's avatar
      vivran22
      Community Champion
      Hi,

      Has this been resolved?

      Rgds,
      Vivek
  • vivran22's avatar
    vivran22
    Community Champion

    FilipFireFlyBI 

     

    Hi,

     

    Please see the solution in the pbix file here

     

    Rgds,

    Vivek

     

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