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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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