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

Totals for calculated columns do not add up

Good evening, 

 

I am working on a dashboard that calculates the new total cost based on a category limit chosen from another table. 

Below is the example of what I am working on and the formulas for each column that I have. Totals for each calculated column are not equal to total, but calculated by the totals from other columns. 

 

Distinct Member Count= calculate(DISTINCTCOUNT(Cost[Member ID]), Cost)

Cost per Distinct Member= divide(sum(cost[paid],distinctcount(cost[Member ID])

Limited Cost per Member= if([Cost per Distinct Member]<'Category Limits'[Limit],[Cost per Distinct Member],'Category Limits'[Limit]) ---- Capping the medical cost by selecting a value from another table

New Total Cost= [Distinct Member Count]*[Limited Cost per Member]

Difference in Total Cost= sum(Cost[Total Cost])-[New Total Cost])

 

 

Any help is appreciated. Worked on it all day, but couldn't find the right formula.

 

2019-11-20_20-59-22.png

2 REPLIES 2
dax
Community Support
Community Support

Hi okaplan, 

Agree with @TomMartens , if possible, could you please inform me more detailed information (such as your sample data and your expected output)? You could use  simple data sample to replace your real data and upload your pbix file on forum by OneDrive or other place we could access. Then I will help you more correctly.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

TomMartens
Super User
Super User

Hey @Anonymous ,

 

without sample data it's almost impossible to detect what's going on, even more as there seem to be some issues with the parenthesis, at least for the "Cost per Distinct Column", whenever DISTINCTCOUNT is involved, it really hard to discover issues just by looking at formulas, without having any clues about the data distribution. 

 

So you might consider to create a pbix that contains sample data, btu still represents your data model and also allows to "recreate the issue", upload the file to onedrive or dropbox and share the link, if you are using Excel to create the sample data, upload the xlsx as well.

 

I note one thing, the measure "Cost per Distinct Member", is using distinctcount(...), whereas the measure "Distinct Member Count" is using CALCULATE(DISTINCTCOUNT(...) , 'cost'), maybe the missing filtertable can mess up the numbers.

 

How do you calculate the correct number "Limited Cost per member"?

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.