Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

Using IF function with DAX to classify account types

Hello all! I'm fairly new to using DAX and Power BI and I keep getting stumped using the IF function.    I'm trying to create a new column in 'edit queries' where I'm trying to classify account cod...
  • Vvelarde's avatar
    10 years ago

    Hi Anonymous make sure thar Account Codes columns is not a text field.

  • jahida's avatar
    jahida
    10 years ago

    Vvelarde is almost certainly right; the workaround is just to change your formula to:

     

    Column = IF(VALUE(DimAccount[AccountCode])<=7999,"Personnel","General")

     

    However, I would say better practice might be:

     

    Column = IF(LEFT(DimAccount[AccountCode]) = "7", "Personnel", "General")

     

    just because it makes it a bit more clear to me. Your call.