Forum Discussion

gaurav-narchal's avatar
2 years ago
Solved

Measure - Greator than

Hello

 

I need help to create a measure as below

 

If the balance is greater than or equal to the Amount return TRUE or else FALSE. I tried to create a measure but did not get the desired result as some of the Amounts are in Negative.

 

Table 1

 

NumberAmountBalanceResult
123456132150TRUE
624970-27337.5-32337.5TRUE
1126484-6156.25-11156.25TRUE
1627998-102790-107790TRUE
2129512-41545-46545TRUE
2631026-8380-2580FALSE
3132540-29475-7980FALSE
36340543905390TRUE
4135568946014460TRUE
463708224607460TRUE
513859619506950TRUE
564011019506950TRUE
6141624200200FALSE
66431381948518000FALSE
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi gaurav-narchal ,

    Hi ryan_mayu , I'm guessing OP is trying to calculate the magnitude of the absolute value🤔. The expected results given by the OP are in perfect agreement with the comparison of absolute magnitudes😀.
    Just change your DAX into this:

    Column = if(ABS('Table'[Balance])>ABS('Table'[Amount]),TRUE(),FALSE())

    Anyway, good answer!

    Best Regards,
    Dino Tao

  • ryan_mayu's avatar
    ryan_mayu
    2 years ago

    gaurav-narchal 

    Pls try 

    Measure = IF(SUM('Table'[Balance])>SUM('Table'[Amount]),TRUE(),FALSE())

    or 

    Measure2 = IF(ABS(SUM('Table'[Balance]))>ABS(SUM('Table'[Amount])),TRUE(),FALSE())

5 Replies

  • gaurav-narchal 

    maybe you can try this

    Column = if('Table'[Balance]>'Table'[Amount],TRUE(),FALSE())

     

    why the result for second row (624970) is True? the balance is less than amount.

    could you pls elaborate the logic?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi gaurav-narchal ,

      Hi ryan_mayu , I'm guessing OP is trying to calculate the magnitude of the absolute value🤔. The expected results given by the OP are in perfect agreement with the comparison of absolute magnitudes😀.
      Just change your DAX into this:

      Column = if(ABS('Table'[Balance])>ABS('Table'[Amount]),TRUE(),FALSE())

      Anyway, good answer!

      Best Regards,
      Dino Tao

      • gaurav-narchal's avatar
        gaurav-narchal
        Helper I

        Anonymous   - Thanks I now got the result. Is there a way I can get the same result with measure instead of the column?