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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
rosefei
Microsoft Employee
Microsoft Employee

formula sum vs table sum

Hi all,

 

I have a rating table that have the following columns:

1) service

2) categoryID

3) subcategoryID

4) rating

5) target

6) BelowTarget = IF(rating<target, "Yes", "No)

7) BelowTargetDepth = if([Rating]<[TargetProfile],[TargetProfile]-[Rating],0)

 

And a meausre:

TargetIndex = SUM([BelowTargetDepth])*COUNT([SubCategoryID])

 

When I put a table together, the sum is different... how do I write the formula so that the sum on each row is the same as the bottom?

servicecategorytargetcount of rating (below target)sum of depthTargetIndex = count of rating * sum of depth
AC13212
AC13111
AC13122
AC13111
AC135525

sum at the table:                10                                              10                    100

 

You can tell the column TargetIndex does not add to 100... I am confused.. Thank you for your help!!

7 REPLIES 7
az38
Community Champion
Community Champion

hi @rosefei 

i could not to repeat your data model, but it looks like task for SUMX() function, like

TargetIndex = SUMX('Table',CALCULATE(SUM([BelowTargetDepth]))*CALCULATE(COUNT([SubCategoryID])) )

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
rosefei
Microsoft Employee
Microsoft Employee

Very interesting! I think we are close. Still have a small prob. 

 

Now the targetIndex in each row is not doing the multiplication any more. I think this is because the underlying table is on subcategory level, the SUMX is only doing on row level sun, which means the count(subcategroyID) is always 1. 

 

I tried a few different combination but still not getting the right answer...

Anonymous
Not applicable

in sumx if you want to multiply column with total count you need to use all.

 

COunt measure=calculate(count(table[Column]),all(table[Column]))

 

Then use it in sumx.

SumX(table,table[Col1]*[Count measure])

 

Refer microsoft documentation

https://docs.microsoft.com/en-us/dax/all-function-dax

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Thank you for your input, I tried to respond multiple times but the website kept crashing. 

 

Unfortunately this did not solve my prob. 

Anonymous
Not applicable

What issue are you facing?
Chthonian
Helper III
Helper III

Hi @rosefei ,

 

Looking at your description and your DAX, you seem to be using a measure that you have not defined "[TargetProfile]" - what is this calculation?

Target = TargetProfile. Sorry I typed the table and did not type the name right

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.