Forum Discussion

Madhans's avatar
Madhans
Frequent Visitor
3 years ago

New Column DAX

Actually what I need is zero in my LOGIC column whenever I meet the below requirements(IN DAX),

But if you see in the USD AMOUNT column the 175 data should not be zero in the LOGIC column because both 175 are positive.

Kindly help me out with the modifications that I have to make in the DAX.

4 Replies

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

    Hi Madhans 

    Please try

     

    Logic =
    VAR PO = Table1[PO No]
    VAR USD = Table1[USD Amount]
    VAR T =
        CALCULATETABLE (
            Table1,
            ALLEXCEPT ( Table1, Table1[Month], Table1[PO No], Table1[Account Code ] )
        )
    VAR A1 =
        COUNTROWS ( FILTER ( T, Table1[USD Amount] = USD ) )
    VAR A2 =
        COUNTROWS ( FILTER ( T, ABS ( Table1[USD Amount] ) = ABS ( USD ) ) )
    RETURN
        IF ( PO <> BLANK () && A1 <> A2 && A2 >= 2, 0 )

     

  • Madhans's avatar
    Madhans
    Frequent Visitor

    Hi Tamerj,

    Thanks for the effort!
    but what i am getting is as  

    My month filter is Aug only, I am getting 0 in a Logic column for all three rows which should not be the case . I should get a zero for the negative sign 14790 and either of any positive sign 14790 value in the USD Amount column. For Example : USD Amount Logic -14790 0 14790 0 14790


    My month filter is Aug only, I am getting 0 in a Logic column for all three rows which should not be the case . I should get a zero for the negative sign 14790 and either of any positive sign 14790 value in the USD Amount column.

    For Example :

    USD Amount      Logic

    -14790                  0
    14790                   0
    14790

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

      Madhans 
      There must be a condition that defines which one of them shall be assigned a 0

      • Madhans's avatar
        Madhans
        Frequent Visitor

        My requirement is if the Month, Po No, and Account code is the same then we have to check the USD amount column if the value is like for exam 475 and - 475 then there should be zero otherwise it should be blank, there are certain Month, Po no, and Account code that is having only positive values or negative values so those should be blank.

        It is a kind of nullifying the usd amount based on Month,Po No,Account code.