Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi All
Below code no error , i like to modify :-
GL CODE from 30000 till 39999 = COGS
Solved! Go to Solution.
Hi,
This calculated column formula works fine
Column = if(AND('Table'[GL CODE]>=30000,'Table'[GL CODE]<=39999),"COGS",BLANK())
Hope this helps.
Can this work?
Hi Sir
Thank you for sharing .
The image very blur , I Cannot see your code . Basically i need some thing like below :-
Can you share how to write in PBI ?
If([GL Code]>=30000 and [GL Code]<=39999) as [COGS],
It's just removing max:
Hi Sir
I still get error :-
The syntax for 'Table' is incorrect. (DAX(SWITCH(TRUE(),Table[GL CODE]>=30000,"COGS",Table[GL CODE]<=39999,"COGS",BLANK()))).
https://www.dropbox.com/s/ibrj9aa1hmiqov4/GL_%20TDS%20v0006.pbix?dl=0
Above my PBI file
Paul Yeo
Hi,
This calculated column formula works fine
Column = if(AND('Table'[GL CODE]>=30000,'Table'[GL CODE]<=39999),"COGS",BLANK())
Hope this helps.
Hi Ash
thank you very much it work fine now.
Paul
You are welcome.
@Anonymous , Create a new column, not measure
Dax_Recode =
SWITCH(TRUE(),('Table'[GL CODE])<=30000,"REVENUE",('Table'[GL CODE])<=39999,"COGS",BLANK())
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 192 | |
| 125 | |
| 99 | |
| 67 | |
| 48 |