Forum Discussion

automated_user's avatar
automated_user
Frequent Visitor
3 years ago
Solved

For each instance a string value appears in a column add to a sum for that specific value

Hi, 

I need help with getting a summed value based on the number of times a string value from one column appears in another column. For example: 

For each distinct value in a column named PartNum:

take that value and find each instances of it in a column named RowCount.PseudoLines:

For each instance that it is found, I need to sum up the values in the NonConfig-PN field:

Thank you

  • automated_user's avatar
    automated_user
    3 years ago

    I was able to figure it out through a measure. In the calculation I also filter by the given year it appears in as well.

     

     

     

3 Replies

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

    Hi, automated_user ;

    From your screenshot, I am confused as to why it is the result of 00111 (link the two figures above).

     Can you use a simple example and want the result to be output? In order to understand your logic and train of thought.

    How to upload PBI in Community


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

    • automated_user's avatar
      automated_user
      Frequent Visitor

      v-yalanwu-msft NonConfig-PN can be any range of numbers. But here is an example:

      PartNumRowCount.PseudoLinesNonConfig-PNTotal
      aaabbb42
      cccaaa13
      aaaddd02
      bbbbbb26
      bbbaaa16
      dddccc30
      aaaddd02

      So if you take 'aaa' from PartNum and find each instances of it in the RowCount.PseudoLines.. for that instance it appears you would sum up the NonConfig-PN in that row it appears in. So the Total would be '2' for 'aaa'. 

      Hope this helps!

      • automated_user's avatar
        automated_user
        Frequent Visitor

        I was able to figure it out through a measure. In the calculation I also filter by the given year it appears in as well.