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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Luca2020
Helper I
Helper I

Summarize problem

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. 

 

Table1.png

 

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!

 

1 ACCEPTED SOLUTION
DavisBI
Solution Specialist
Solution Specialist

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!

View solution in original post

1 REPLY 1
DavisBI
Solution Specialist
Solution Specialist

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!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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