Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

SUMPRODUCT Measure Using Fields from Same Table

I'm trying to create a Measure that calculates the SUMPRODUCT using fields from the same table.  

Using an EXCEL layout as seen below, the formula used to calculate the ".024%" in D1 is:  =SUMPRODUCT(A3:A26, B3:B26, D3:D26) / SUMPROUCT(A3:A26, D3:D26)

 A     B       C       D
  0.19%0.24%
TermRate12MoPmts24MoPmts
10.001781440.8151239704.72307
20.001781780.1518539870.15941
30.001782120.9024840036.28508
40.001782463.0729140203.10293
50.001782806.6690540370.61586
60.001783151.6968440538.82676
70.00176666783498.1622440707.73854
80.00183333383846.0712540877.35412
90.001984195.4298841047.67642
100.00196666784546.2441741218.70841
110.00203333384898.5201941390.45303
120.002185252.2640241562.91325
130.002175041736.09205
140.00224375041909.99244
150.002319375042084.61741
160.002395042259.96998
170.002470625042436.05319
180.00254625042612.87008
190.002621875042790.4237
200.0026975042968.71713
210.002773125043147.75345
220.00284875043327.53576
230.002924375043508.06716
240.003043689.35077

 

I'm currently using the following formula in PowerBI but I'm getting different/incorrect results:

=SUMX('Table1', 'Table1'[Rate] * LOOKUPVALUE('Table1'[24MoPmts], 'Table1'[Term], 'Table1'[Term])) / SUMX('Table1', LOOKUPVALUE('Table1'[24MoPmts], 'Table1'[Term], 'Table1'[Term]))

This formula returns ".22%", but it should be ".24%".   

  • Hi Anonymous ,

    In that case, I suppose you don't need to include that 'Term' column in your sumproduct calculation either, and when that is removed, Power BI sumx calculation result and sumproduct calculation results are the same, although I would write dax formula in the following manner which is simpler.  

    Best regards,

     

3 Replies

  • Hi Anonymous 

    In your Excel formula, term is also included, but I would have throught that the overall rate calculation should be based on the amount and the rates only. I'd appreciate it if you could let me know why the indexing column of "Term" should also be included in the calculation.  

    Best regards,

    • Anonymous's avatar
      Anonymous
      Not applicable

      DataNinja777  I'm not sure actually, that's just the exact formula that is being used in the Excel calculation but if it's not necessary to get to the correct answer then I suppose it's not applicable.

  • Hi Anonymous ,

    In that case, I suppose you don't need to include that 'Term' column in your sumproduct calculation either, and when that is removed, Power BI sumx calculation result and sumproduct calculation results are the same, although I would write dax formula in the following manner which is simpler.  

    Best regards,