Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
12 | |
11 | |
9 | |
6 | |
6 |