Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
gramespa
Frequent Visitor

Rebuild SQL Code in DAX or M

Hi all,

 

I hope this question isn't too unique:

 

I would like to find out wheter it is feasable to rebuild to SQL-Code somehow using DAX or M to create some sort of calculatet table?

 

INSERT INTO "Table"("XY","XX","YY","V")
Select
    "EKPO"."MANDT" || "EKPO"."EBELN"||"EKPO"."EBELP" AS "XY"
    ,'Create Purchase Order Item 'as "XX"
    ,"EKKO"."AEDAT" AS "YY"
    ,20 AS "V"
FROM "EKPO"

JOIN "EKKO" ON
"EKPO"."EBELN"="EKKO"."EBELN" AND
"EKPO"."MANDT"="EKKO"."MANDT"

Where "EKKO"."BSTYP"='F';
 
 
Any ideas on this?
 
Thank you all
 
Best regards
 
1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @gramespa,

 

assuming you have the tables EKPO and EKKO in your model, you can handle this in Power Query/M.

 

First use the the Merge queries as new-function. Choose the to column to join on and change join type to inner join. Expand the column with "Table" as values. Now select three columns you want to concatenate, right click and select merge columns. Filter the column BSTYP=F. Add custom columns for "XX" and "V" with constant value. Now remove all unneccessary columns.

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi, @gramespa,

 

assuming you have the tables EKPO and EKKO in your model, you can handle this in Power Query/M.

 

First use the the Merge queries as new-function. Choose the to column to join on and change join type to inner join. Expand the column with "Table" as values. Now select three columns you want to concatenate, right click and select merge columns. Filter the column BSTYP=F. Add custom columns for "XX" and "V" with constant value. Now remove all unneccessary columns.

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.