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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculated Measure Returns Incorrect Results

Hi,

I am trying to calculate a gross profit based on sales and COGS.

I have two measures: [total sales] and [total cost of sales and services].

I created a measure: 

Gross Profits = [Total Sales]-[Total Cost Of Sales and Services]
But it returns incorrect results:
 
 
Screenshot 2021-06-23 102606.png

 

e.g, the first line should be (320091-218214=101877) and not 1733810.

 

Can you please help?

thank you!

Maya

 
4 REPLIES 4
Anonymous
Not applicable

Total sales was 

Total Sales = sum(Sales[Sales ($K)])
Cost of sales and services was this column (cost of sales alllocated by product):
Cost Of Sales and Services =
Sales[AllocationRate]*CALCULATE(sum(lvl2_Expenses[Cost of sales and services]))
and then this measure:
Total Cost Of Sales and Services = sum(Sales[Cost Of Sales and Services])

Cost of sales total seems correct when I display it- but the measure would not work.
Unfortunately, the data is sensitive so I cannot send it....

@Anonymous , I see this as a problem, multiplication should happen at line level or you should force a level

assuming AllocationRate is also a measure

on a common dimension

sumx(Values(Dim[Dim]),[AllocationRate]*CALCULATE(sum(lvl2_Expenses[Cost of sales and services])))

Anonymous
Not applicable

Hi Amit,

AllocationRate is a column. would that syntax still work?

amitchandak
Super User
Super User

@Anonymous , seem strange, can share calculations for   [Total Sales]-[Total Cost Of Sales and Services].

 

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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