Forum Discussion
Iterative/Recursive Calculations
- Anonymous6 years ago
Please find the PQ solution attached. When you open, please go to Power Query and have a look at the function I created to get the price of a product. The assumption is that products are in the first column and only for them do you have to calculate the total price.
Original Data is the table with your original data.
Products with final prices is the table with final prices.
getTotalProductPrice is the function that does the recursion...
You have to check this procedure against a representative number of cases because I used your data and made assumptions which might not be true about the full set. You have to TEST.
Best
D
DAX has not been designed to handle such situations. Recursion is not supported. Only a version called sideways recursion is but it does not apply to your case.
PBI/DAX is not Excel.
Best
D
- Anonymous6 years agoNot applicable
Thank you for your answer Anonymous
How would a solution to this simple example look like in Power Query? I'm trying to avoid having to export the data and process it with other software.
- Anonymous6 years agoNot applicableI'm trying to create a PQ solution but it's not going to be for the faint of heart...
Best
D- Anonymous6 years agoNot applicable
Please find the PQ solution attached. When you open, please go to Power Query and have a look at the function I created to get the price of a product. The assumption is that products are in the first column and only for them do you have to calculate the total price.
Original Data is the table with your original data.
Products with final prices is the table with final prices.
getTotalProductPrice is the function that does the recursion...
You have to check this procedure against a representative number of cases because I used your data and made assumptions which might not be true about the full set. You have to TEST.
Best
D