Forum Discussion
Possibilities or limitations of M in Power Query
Hi,
I'm rather new in using M in Power Query. I read the documentation and tried it out in Power BI Desktop. Still, I'm not sure if I can solve the challenge I have. I need to create a dataset for forecasting cashflow from the Dataverse tables salesorder and salesorderdetail in Dynamics 365. Salesorder has the following columns: start date, end date, payment terms (30/60/90 days), invoice frequency (monthly, quarterly, annually), next price index adjustment date and price index type. Salesorderdetail has the columns: monthly amount, currency, salesorder. The Cashflow forecast table is not present in Dataverse.
I would like to create a table in M for cashflow forecast based on calculations from salesorder and salesorderdetail. It should records for every month we expect cash. This is based on the start date, end date, payment terms and invoice frequency. The amount is based on the montly amount, invoice frequency (1, 3, 12) and should be indexed annually on the next price index adjustment date, based on the user's input on the Power BI report for the price index type. Furthermore, the first and last cashflow isn't usually a full period (month/quarter/year), but other cashflows follow the calendar periods (month/quarter/year).
I already have experience in creating invoices from this data in a Power Automate flow. This is just for creating the coming invoice, not all invoices for the whole period of the sales order. In Power Automate I needed to multiple (global) variables, that I need to update on various places in the flow. I understand that the same variable can't be created/updated on different place in M. So, this is my first challenge. How do I reuse variables? I also have multiple conditions, switches and Compose Data Operations. I know this could be possible in M, but how do I maintain overview of the query? In Power Automate it's based on a graphical user interface. Are there any tools for M like that or maybe a converting tool for a whole or parts of PA cloud flow to an M query?
Or do I need to look at other query languages or solutions to be able to create the forecasting data? I know that creating and updating the forecasts in Dataverse is feasable, but not a desirable solution.
1 Reply
- BA_Pete
Super User
Hi TimothyBohte ,
This doesn't sound like an Power Query/M think to me, to be honest.
PQ & M are for importing and transforming your data into an efficient size and structure. Calculations and dynamic items should be done using DAX on the data model.
This sounds like a pretty in-depth project, so maybe not something anyone here is going to be able to walk through end-to-end for you, but feel free to post here if there's parts of it that you get stuck on.
Pete