Forum Discussion

Avivek's avatar
Avivek
Post Partisan
6 years ago

Calculated column for weighted average does not work for few rows

I had created a calculated column for total weight calculation which was (days difference* payment recieved). This calculated column works fine for few rows fetching the correct value on multiplication but few rows the multiplication values do not match. let me share the screenshot for it:

 

 

The calculated column is ,

Weight = RECEIVABLES[Days Diff]*RECEIVABLES[PAYMENT_AMOUNT]
 
Since it did not fetch the value I needed I created a new measure
Weight(measure)= CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]*VALUE(sum(RECEIVABLES[PAYMENT_AMOUNT]))))
 
Though the measure works well but then the issue is that the total is not correct.
I need the total weight for another measure to fetch  me the weighted average days.

9 Replies

  • Avivek 

    Try:

    Weight(measure)= CALCULATE(SUMX(RECEIVABLES,RECEIVABLES[Days Diff]* RECEIVABLES[PAYMENT_AMOUNT]))

    ________________________

    Did I answer your question? Mark this post as a solution, this will help others!.

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube, LinkedIn 

    • Avivek's avatar
      Avivek
      Post Partisan

      Thankyou Fowmy , but this measure does't work, it gives the same issue like the calculated column

       

      • Fowmy's avatar
        Fowmy
        Super User

        Avivek 


        The measure works for me, please check your model and the data.


         







        ________________________

        Did I answer your question? Mark this post as a solution, this will help others!.

        Click on the Thumbs-Up icon if you like this reply 🙂

        YouTube, LinkedIn