Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago

SUMX returning wrong values for some rows

Dear All,

 

Im facing a issue while using SUMX funciton.  I Wrote the below DAX statement to calculate the Avg price using SUMX function. I found that SUMX is not working for few Rows and returning wrong values.

Could somebody chack my logic and correct me if i made any mistakes in the DAX

 

Avg_price_Gram = SUMX(MT_Monthly_TertiarySales,DIVIDE(MT_Monthly_TertiarySales[Monthly Sales Amt],MT_Monthly_TertiarySales[Monthly Sales Unit Qty]* MT_Monthly_TertiarySales[Base Pack Qty]))

 

Brand    Sale Amount        Qty           Gram     Avg price per Gm

 

Thanks & Regards,

Rajeev Bikkani

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Is the view you're showing us the Table view, the Data view, or is it a visual?  Can we see the field names on the image?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      The screen shot which im showing is table visual. My

      i need to do    Avg price per gm = Monthly sales amt / (Monthly sales unit qty * Base pack qty)  for each row. But my calculation is going wrong for many rows.

       

      below is my DAX formula.

       

      1_MT_Avg_price_Gram = SUMX(MT_Monthly_TertiarySales,DIVIDE(MT_Monthly_TertiarySales[Monthly Sales Amt],MT_Monthly_TertiarySales[Monthly Sales Unit Qty]* MT_Monthly_TertiarySales[Base Pack Qty]))

       

      If you see the below screen shot most of the rows are showing wron values. Kindly help me to fix the issue

      Thanks & Regards,

      Rajeev

      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Is what you are showing the raw data and are you using the SUMX in a calculated column or a measure?

  • Hi,

     

    What result do you get with this?

     

    =IFERROR(MT_Monthly_TertiarySales[Monthly Sales Amt]/(MT_Monthly_TertiarySales[Monthly Sales Unit Qty]* MT_Monthly_TertiarySales[Base Pack Qty]),BLANK())