Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

IF statement in dax

Hello!!

I have a question about IF en DAX, I hope someone  could helpme

 

I have this values

10000

345.67

897.01

100

750

783

321.45

890.5

0

etc

 

I want to check if the number afther the . (dot) is 00 and im trying with this,

 

Value.00 = IF(MOD('MyTable'[TOTAL],SIGN('MyTable'[TOTAL))=00,1,0)

 

but I have this error:

Division by zero has occurred when evaluating function 'MOD'.

 

Are not sure what others options can use.

 

Thanks for the help

Mónica

  • Hi Mónica,

     

    Try this formula, please.

    Column =
    IF (
        SEARCH ( ".", [Value],, 9999 ) = 9999,
        1,
        IF ( RIGHT ( [Value], 2 ) = "00", 1, 0 )
    )
    

    IF_statement_in_dax

     

    Best Regards,

    Dale

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous

     

    Try this:

     

    Column = IF(RIGHT(Table[Total,2)="00", 1,0)

     

    Thanks
    Raj

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous

       

      Thanks for your reply.

       

      This option doesnt work for me, because the numbers like

       

      1000

      750

       dont show the .00 but its has it.

      with this opcion only show me the 1000 and the 750 dont show me, but should it.

       

      Thanks again

      Monica

      • Anonymous's avatar
        Anonymous
        Not applicable

        I hope your data type is decimal, so if you set the number of decimal to 2, you will have 1000.00, 745.34.And ths formula will work.

         

        Please let me know if you see any issues.

         

        Thanks

        Raj

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    Hi Mónica,

     

    Try this formula, please.

    Column =
    IF (
        SEARCH ( ".", [Value],, 9999 ) = 9999,
        1,
        IF ( RIGHT ( [Value], 2 ) = "00", 1, 0 )
    )
    

    IF_statement_in_dax

     

    Best Regards,

    Dale

    • Anonymous's avatar
      Anonymous
      Not applicable

      HI v-jiascu-msft

       

      Thanks for your help!!

      It works perfect

       

      Greetings 

      Mónica