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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Single cost calculation for multiple orders

Hello

I have a table with orders in different statuses and I need to calculate the cost only once for each order but I don't get it right.

When I put this expression at the column level, it works fine

CALCULATE(SUM(Price[Price])*sum(Touched[may-24])*sum(Agencies[Department])*SUM(AHT[may-24]), Agencies[Agency]="Marktel",Price[Agency] = "Marktel")
But when I try to put in the measurement it doesn't work anymore and I can't leave it at the column level because then in the view it adds the cost of each line and in total it comes out badly.
SUMX(DISTINCT(Sales[OT No.]),CALCULATE(SUM(Price[Price])*sum(Touched[may-24])*sum(Agencies[Department])*SUM(AHT[may-24]), Agencies[Agency]="Marktel",Price[Agency] = "Marktel"))
Can anyone help me?
Best regards,
Thais
2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hello

This is the table, as you can see the cost column is where the formula is:

Cost = CALCULATE(SUM(Price[Price])*sum(Touched[may-24])*sum(Agencies[Department])*SUM(AHT[may-24]), Agencies[Agency]="Marktel",Price[Agency] = "Marktel")+
CALCULATE(SUM(Price[Price])*sum(Touched[may-24])*sum(Agencies[Department])*SUM(AHT[may-24]), Agencies[Agency]="Bosch",Price[Agency] = "Bosch")

And it does the calculation well, but when I take the model it brings me 2 times the cost for the same order, so I have tried to make this measurement:

Provi Ribs = sumx(Sales,CALCULATE(SUM(Price[Price])*sum(Touched[may-24])*sum(Agencies[Department])*SUM(AHT[may-24]), Agencies[Agency]="Marktel",Price[Agency] = "Marktel", DISTINCT(Sales[OT No.])))+sumx(Sales,CALCULATE(SUM(Price[Price])*sum(Touched[may-24])*sum(Agencies[Department])*SUM(AHT[may-24]), Agencies[Agency]="Bosch",Price[Agency] = "Bosch", DISTINCT(Sales[OT No.])))
But it's still doubling the cost.

ThaisMoita_0-1717142199041.png

Anonymous
Not applicable

Hi @Syndicate_Admin ,

In order to better understand your demands and give the right solution, could you please provide some more specific information? such as your desensitized example data and a screenshot of your desired results?

 

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.