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! It's time to submit your entry. Live now!
Hi, I have extrcted a table and I'm trying to add different columns to the table. However, while creating the column it's created with DAX code and I need to convert it to M language.
The table name is : F0901
DAX code:
Solved! Go to Solution.
M doesn't have a SWITCH function, but for what you are doing, that will be fine.
if [Obj Account]>= 1100 and [Obj Account]<1230 then "Cash & Banks" else
if [Obj Account]>= 1230 and [Obj Account]<1400 then "Account Receivables & Others AR" else
if [Obj Account]>= 1400 and [Obj Account]<1800 then "Inventory" else
..
if [Obj Account]>=8600 and [Obj Account]<9300 then "G& A Expenses" else
if [Obj Account]>= 9300 then "Financial Epenses" else
null
Add a custom column with the above code in it. I didn't do all 20 lines, just the first 3 and last 2 so you could see the pattern. A few notes:
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingM doesn't have a SWITCH function, but for what you are doing, that will be fine.
if [Obj Account]>= 1100 and [Obj Account]<1230 then "Cash & Banks" else
if [Obj Account]>= 1230 and [Obj Account]<1400 then "Account Receivables & Others AR" else
if [Obj Account]>= 1400 and [Obj Account]<1800 then "Inventory" else
..
if [Obj Account]>=8600 and [Obj Account]<9300 then "G& A Expenses" else
if [Obj Account]>= 9300 then "Financial Epenses" else
null
Add a custom column with the above code in it. I didn't do all 20 lines, just the first 3 and last 2 so you could see the pattern. A few notes:
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingThank you very much for your help very helpful
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 18 | |
| 13 | |
| 9 | |
| 8 | |
| 8 |