Forum Discussion

JackEnviro's avatar
JackEnviro
Helper I
7 years ago
Solved

Infinity issue with DIVIDE multiply and subtract

Hi All 

 

The formula below works but with an infinity issue

 

Sales Total (Net) = SUMX('Invoices',('Invoices'[LineItem_UnitAmount]*'Invoices'[LineItem_Quantity] - 'Invoices'[CreditAmount] )/Invoices[LineItem_TaxAmount])

 

I have tried converting to a DIVIDE but can't seem to get it to work. 

 

Any suggestions much apprecated 

 

Thanks 

Jack 

  • Hi JackEnviro ,

     

    Have you tried the following code:

     

    ttt =
    SUMX (
        'Invoices',
        DIVIDE (
            ( 'Invoices'[LineItem_UnitAmount] * 'Invoices'[LineItem_Quantity] - 'Invoices'[CreditAmount] ),
            Invoices[LineItem_TaxAmount]
        )
    )

    If this doesn't work can you share some sample information and expected result?

     

    Regards,

    MFelix

2 Replies

  • Hi JackEnviro ,

     

    Have you tried the following code:

     

    ttt =
    SUMX (
        'Invoices',
        DIVIDE (
            ( 'Invoices'[LineItem_UnitAmount] * 'Invoices'[LineItem_Quantity] - 'Invoices'[CreditAmount] ),
            Invoices[LineItem_TaxAmount]
        )
    )

    If this doesn't work can you share some sample information and expected result?

     

    Regards,

    MFelix

    • JackEnviro's avatar
      JackEnviro
      Helper I

      Hi felix 

       

      Sorry thought that solved it but it, is not working but result 36 is not what is expected, should be £1957.34, or close to

       

      The underlying table for that invoice look like this:

       

      LineItem_QuantityLineItem_UnitAmountLineItem_ItemCodeLineItem_TaxAmountLineItem_LineAmountInvoiceNumberSubTotalTotalTaxTotalAmountPaidAmountCreditedTax%CreditAmount            
      4627.36D-H-S-4209.761258.56EB132691957.34392.052349.392349.3901.20            
      1812.39DA-SP-1072.4432.59EB132691957.34392.052349.392349.3901.20            
      520.99DA-TC-B17.5104.95EB132691957.34392.052349.392349.3901.20            
      3518.57DA-J-P-50108.5649.95EB132691957.34392.052349.392349.3901.20            
      1-123.65 -20.61-123.65EB132691957.34392.052349.392349.3901.20            
      126.99DA-LC-B4.526.99EB132691957.34392.052349.392349.3901.2LineItem_QuantityLineItem_UnitAmountLineItem_ItemCodeLineItem_TaxAmountLineItem_LineAmountInvoiceNumberSubTotalTotalTaxTotalAmountPaidAmountCreditedTax%CreditAmount
                  4627.36D-H-S-4209.761258.56EB132691957.34392.052349.392349.3901.20
                  1812.39DA-SP-1072.4432.59EB132691957.34392.052349.392349.3901.20
                  520.99DA-TC-B17.5104.95EB132691957.34392.052349.392349.3901.20
                  3518.57DA-J-P-50108.5649.95EB132691957.34392.052349.392349.3901.20
                  1-123.65 -20.61-123.65EB132691957.34392.052349.392349.3901.20
                  126.99DA-LC-B4.526.99EB132691957.34392.052349.392349.3901.20

       

      Thank

      Jack