Forum Discussion

Denet's avatar
Denet
Regular Visitor
5 years ago
Solved

Measure SUM + IF

Dear all, please help. I have a table in which I want to separate debtors from creditors

 

 

I created 2 measures:

Debitors = IF(CALCULATE(SUM('Table'[Summ]))<0,CALCULATE(SUM('Table'[Summ])),0)
Creditors = IF(CALCULATE(SUM('Table'[Summ]))>0,CALCULATE(SUM(Table'[Summ])),0)
When I put them in Matrix Total is eq 0 or calculated incorrect. 

 

What i did wrong?

  • Hi Denet ,

     

    Try to create another measures to get the right total value like so:

     

    Debitors - Modified =
    SUMX ( 'Table', [Debitors] )
    

     

    Creditors - Modified =
    SUMX ( 'Table', [Creditors] )
    

     

    Please check if these measures could help you.

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 Replies

  • Denet , Create three measures like

     

    Summ value = SUM('Table'[Summ])


    Debitors = sumx(filter( values(Table[Name]),[Summ value] <0), [Summ value])


    Creditors = sumx(filter( values(Table[Name]),[Summ value] >0), [Summ value])

    • Denet's avatar
      Denet
      Regular Visitor

      amitchandak 

      Tank you for idia but in this case it filters only pozitiv values of table (whithout calculating them)

       

      And adding 

      Summ value = CALCULATE(SUM('Лист2'[Сумма]))
      The same do not give effect 

       

  • Icey's avatar
    Icey
    Community Support

    Hi Denet ,

     

    Try to create another measures to get the right total value like so:

     

    Debitors - Modified =
    SUMX ( 'Table', [Debitors] )
    

     

    Creditors - Modified =
    SUMX ( 'Table', [Creditors] )
    

     

    Please check if these measures could help you.

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.