Forum Discussion
Anonymous
10 years agoNot applicable
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...
- 10 years ago
Hi Anonymous make sure thar Account Codes columns is not a text field.
- 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.
jahida
10 years agoImpactful Individual
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.