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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Matt_H_Clam
Frequent Visitor

Converting excel connection to Dax - ie SQL to Power Query and DAX

Ive inherited a spreadsheet that connects to a local SQL database with a command string and the following command text;

 

SELECT shipmentitems.partid, shipmentitems.ordertype, invoiceitems.quantity, invoiceitems.createddate, shipments.traderid, invoiceitems.homeunitprice, partrevisions.bommethod, partrevisions.routingmethod, allpartmaster.sm, orderitems.vatcode, allpartmaster.fsunit, invoiceitems.currencyunitprice, allpartmaster.casting, invoices.taxdate, invoices.status, allpartmaster.fsmat, allpartmaster.fssubcon
FROM efacdb.dbo.allpartmaster allpartmaster, efacdb.dbo.invoiceitems invoiceitems, efacdb.dbo.invoices invoices, efacdb.dbo.orderitems orderitems, efacdb.dbo.partrevisions partrevisions, efacdb.dbo.shipmentitems shipmentitems, efacdb.dbo.shipments shipments
WHERE orderitems.orderid = shipmentitems.orderid AND shipmentitems.shipmentid = shipments.id AND orderitems.itemnumber = shipmentitems.orderitemnumber AND invoiceitems.shipmentid = shipmentitems.shipmentid AND shipmentitems.itemnumber = invoiceitems.shipmentitemnumber AND partrevisions.partid = invoiceitems.partid AND partrevisions.partid = orderitems.partid AND partrevisions.partid = shipmentitems.partid AND partrevisions.partrevisionid = orderitems.partrevisionid AND partrevisions.partrevisionid = shipmentitems.partrevisionid AND invoiceitems.partid = allpartmaster.partnum AND invoiceitems.invoiceid = invoices.id AND ((shipmentitems.ordertype='SO'))
ORDER BY shipmentitems.partid, shipments.traderid, invoiceitems.createddate

 

 

I wish to recreate as a data model in PowerBI desktop then publish to the service using our gateway.

 

So far in desktop I have created a connection to the database in Power Query and imported the relevant tables no problem (with filters to limit data to the last 12 months)

 

I have also created 1 to many relationships where the above command says a field in one table equals one in another or created a master table for fields with a many to many.  This covers the FROM and WHERE

 

Being a novice here with the Select part of the command im looking to create a new table in the model using DAX and my  thought process was to use;

 

New Table = SUMMARIZECOLUMNS(

                                                             shipmentitems[part.id], shipmentitems[ordertype], invoiceitems[quantity], shipments[traderid] etc etc 

)

 

 

the new table is hanging when i press enter and i just get the 'im working on it' message.

 

Is there a better way? or have i fundamentally got it right/wrong?

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@Matt_H_Clam , if data is really big, then having a dax table is not a good idea.  It can also issues because of system performance.  Check RAM and Hard disk availability

 

Try to bring this from DB, in not try in power query

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thanks. I am using 20%CPU and 4GB of memory on my laptop as its trying to run.. I have 32GB RAM and a Core i7 2.8ghz Processsor so its pretty meaty

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.