Forum Discussion

marcio_fornari's avatar
marcio_fornari
Resolver I
5 years ago
Solved

Measure repeating values for table

Hello,

I have a table with 2 columns.. Type and Value

 

Measure 1: 

toPay = 
CALCULATE(
    SUM(PAYMENTS[value]),
    PAYMENTS[type] = "pay"
)

 

Measure 2:

toReceive = 
CALCULATE(
    SUM(PAYMENTS[value]),
    PAYMENTS[type] = "receive"
)

 

The table is reapeating values for pay and receive, why?

 

I think this solution is:

 

  • marcio_fornari , Try like

     

    toPay =
    CALCULATE(
    SUM(PAYMENTS[value]),
    filter(PAYMENTS, PAYMENTS[type] = "pay")
    )

     

    toReceive =
    CALCULATE(
    SUM(PAYMENTS[value]),
    filter(PAYMENTS,PAYMENTS[type] = "receive")
    )

     

    refer : dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/

2 Replies

  • marcio_fornari , Try like

     

    toPay =
    CALCULATE(
    SUM(PAYMENTS[value]),
    filter(PAYMENTS, PAYMENTS[type] = "pay")
    )

     

    toReceive =
    CALCULATE(
    SUM(PAYMENTS[value]),
    filter(PAYMENTS,PAYMENTS[type] = "receive")
    )

     

    refer : dataap.org/blog/2019/04/22/difference-between-calculate-with-and-without-filter-expression/