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, 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! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |