Forum Discussion

afrutos's avatar
afrutos
Icon for Resolver I rankResolver I
4 years ago

SUM A NUMBER TO A TOTAL

Hello good morning, I have a question.
I have this matrix with Idtipoliq in rows and its final turnover and that of the previous year.
To calculate ADJUST I did: sum('Invoices Annex'[ADJUST AMOUNT])

The case is that I need that:
- For 2018;
if idtipoliq="CP" then I need to add the value 952721 to the total invoicing.
if idtipoliq="TV" then I need the value 622131 to be added to the billing total.
-For 2020: add the value 752000 to the billing total.

I am trying to create a measure but I don't know how to set the year or idtipoliq filters.

 

 

 

THANKS IN ADVANCED

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    afrutos Column references in measures need an aggregation like:

    MAX('TableName'[idtipoliq])

    • afrutos's avatar
      afrutos
      Icon for Resolver I rankResolver I

      Greg_Deckler 

      So how do you suggest to do the calculation?
      Because I think it should be a measure, otherwise it adds that value to each row of invoices, and I just want to add it to the total sum.
      I'm trying this but it doesn't work either.

      ADJUST Final Invoice =
      SUMX(
      'Attachment Invoices',
      IF('Invoices Attachment'[INVOICE YEAR]=2018 && 'Invoices Attachment'[Idtipolyqaccounting 2]="CP", VALUE(SUM('Invoices Attachment'[ADJUST AMOUNT]))+952721.8,
      IF( 'Invoices Attachment'[INVOICE YEAR]=2018 &&'Invoices Attachment'[Idtipolyqaccounting 2]="TV", SUM('Invoices Attachment'[ADJUSTMENT AMOUNT])+622131.45,
      IF( 'Invoices Attachment'[INVOICE YEAR]=2020, SUM('Invoices Attachment'[ADJUSTMENT AMOUNT])+752152,

      'Invoices Attachment'[ADJUSTMENT AMOUNT]))))

       

      • Greg_Deckler's avatar
        Greg_Deckler
        Icon for Community Champion rankCommunity Champion

        afrutos If you just want to add it to the total, use HASONEVALUE('Table'[idtipoliq]), if true, return your value, otherwise return the value + whatever you want to add.