Forum Discussion

kafreitass's avatar
kafreitass
Helper I
3 years ago
Solved

Sum by ID

Hi guys!

Can anybody help me?

I have a table with my sales (Vendas table).  These sales can be received in installments (Column Qtde de Parcelas)

 

 

 

 

I have another Receipts table (Table Recebimentos). It contains all payments made from sales.

I need to check if the sale was received, so I created a new table performing a merge between the ID.

When I perform the sum of the GROSS VALUE column (column VALOR BRUTO), it adds up all the lines, which is the amount of installments that the sale has. How could I perform this sum by ID?

As a final result I would like to check if the total amount of the sale has already been paid or if there are still open installments

 

  • Why don't you switch to a DAX Measure? If I were you I'd proceed this way:


    - Start with setting up the relationship on Stone ID (apparenty 1 to Many from Vendas to Recebimientos)
    - In a table (or matrix) visual, add:

    • Stone ID
    • Total = SUM(Vendas[Valor Bruto])
    • Total_Paid = SUM(Recebimientos[Valor Bruto])
    • Open_Amount = Total - Total_Paid

     

3 Replies

  • Why don't you switch to a DAX Measure? If I were you I'd proceed this way:


    - Start with setting up the relationship on Stone ID (apparenty 1 to Many from Vendas to Recebimientos)
    - In a table (or matrix) visual, add:

    • Stone ID
    • Total = SUM(Vendas[Valor Bruto])
    • Total_Paid = SUM(Recebimientos[Valor Bruto])
    • Open_Amount = Total - Total_Paid

     

  • Hi kafreitass ,

    try this measure

    SUMX(
        SUMMARIZE(
                'Facts',
                'Facts'[STONE ID],
                'Facts'[VALOR BRUTO]
                ),
        'Facts'[VALOR BRUTO]
    )
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.