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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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