Forum Discussion

alhyde's avatar
alhyde
New Member
9 years ago
Solved

IF Statement in DAX Help

I have data in column A that I want to filter into two columns - column B and column C.  Column A contains both negative and positive numbers.  I want postive numbers in column B and negative numbers in column C.  In Excel, this would be a simple IF statment, but I am unsure how to write this in DAX.  Help, please!

  • Anonymous's avatar
    Anonymous
    9 years ago

    alhyde

     

    1. ColumnB= If ( YourTable[ColumnA] >= 0 , YourTable[ColumnA])

     

    2. ColumnC= if ( If ( YourTable[ColumnA] < 0 , YourTable[ColumnA])

     

    If this works for you please accept this as a solution and also give KUDOS.

     

    Cheers

     

    CheenuSing

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    alhyde

     

    1. ColumnB= If ( YourTable[ColumnA] >= 0 , YourTable[ColumnA])

     

    2. ColumnC= if ( If ( YourTable[ColumnA] < 0 , YourTable[ColumnA])

     

    If this works for you please accept this as a solution and also give KUDOS.

     

    Cheers

     

    CheenuSing

    • alhyde's avatar
      alhyde
      New Member

      Thank you for your help, Anonymous!!

  • Try doing it in the query editor

    You can either create two new columns (B and C), one with the positive values, and one with the negative values

    Or create one with the negative values, then filter out the negative values from column A

  • @CheenuSing

     

    Hello,

     

    I had the same question and managed to split the values of column A (amount) over column B (debet) and column C (credit).
    Column A is a measure: SUM(table[Amount]). 
    The issue i have is in the totals. 
    I would like to summerize all (postive) amounts of column B and the (negative) amounts of column C, 

    With this solution above i get totals with 0 and i don't understand that. 

    Can you please help me with this?

    Rob 

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi RobJo

       

      Please post sample data and the expressions used.

       

      Cheers

       

      CheenuSing

  • @CheenuSing

     

    Hi, 

     

    Thanks for your support. 

     

    I don't know how to post sample files on this forum. 
    Here is my e-mail adres: [email protected]

    Please send me a email and i will reply you the sample files.  OK?

     

    Rob Jouvenaar

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi RobJo

       

      I have sent a mail to your hotmail account. Please check and respond.

       

      Cheers

       

      CheenuSing