Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet 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
Hi,
I've a table with the value of each costumer's order, an order may be divided in additional sub-orders or item according to the type of service required. All items from an order may have the same code like 1 for the 11234 order, or multiple codes like 1, 2, 3 for the 11234 order depending on the supplyer which can be the same or not. In any case each item code is unique to the order so, knowing the item code you can always recognize the order number.
In addition to the revenue, I've also a table with the associated expected costs for each items, constantly updated, and a table with the actual costs which is updated monthly.
What I would like to obtain, is a new table which uses the summarize function to summarize, for each order, the actual cost but since this table is uptaded less frequently, I'd also like to see the budget cost in the meantime:
SUMMARIZE('Actual Cost', 'Actual Cost [Order], "Direct Cost", IF(SUM('Actual Cost' [Amount]) = BLANK() || SUM(SUM('Actual Cost' [Amount]) < SUM('Cost Budget'[Amount]), SUM('Cost Budget'[Amount]) ,(SUM('Actual Cost' [Amount])))
The actual costs are always equal or higher than the expected ones because the budget is from the order confirmation to the supplier while the actual cost is from the purchase invoice which may have additional costs for certificates, assurance, customs duty.
My problem is that when I'tried that formula, the amount from the actual is correct while the budget is three times the real one, like Bi multiplies the value by the numbers of row, since the order is one but the item rows are three. Maybe is because the budget has items and the actual cost table has N. of Order.
I cannot use the RELATED function to create a new column with the order numbers in the budget table because of the many to many relationships.
Can someone help?
Thanks!
Solved! Go to Solution.
Hi, @Luca2020 ,
I suggest that you provide the model relationship of different tables, one to many or many to one, which is helpful to solve this problem.
Nevertheless, I have encountered similar problem before.
My solution is to create a new calculation column in the many-end table to calculate the number of rows that will be repeated after use RELATED() from one-end table, and then your measure can be divided by the value in this column to get a value that won't be repeated.
The formula for this calculate column is :
column = countrows(RELATEDTABLE(<your main table>))
You can also refer to this article.
Mark this post as solution if this helps, thanks!
Hi, @Luca2020 ,
I suggest that you provide the model relationship of different tables, one to many or many to one, which is helpful to solve this problem.
Nevertheless, I have encountered similar problem before.
My solution is to create a new calculation column in the many-end table to calculate the number of rows that will be repeated after use RELATED() from one-end table, and then your measure can be divided by the value in this column to get a value that won't be repeated.
The formula for this calculate column is :
column = countrows(RELATEDTABLE(<your main table>))
You can also refer to this article.
Mark this post as solution if this helps, thanks!
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
21 | |
21 | |
19 | |
13 | |
12 |
User | Count |
---|---|
42 | |
28 | |
23 | |
22 | |
22 |