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
tmillerch
Frequent Visitor

Calculating the sum by dividing by a count of another column

Hello everyone,

 

Essentially what I am trying to do is take the hours of each consumerUniqueID and make sure that each consumer completes a monthly check-in of x hours of face to face service each month.  The last two columns are my attempts at trying to solve this and are both miserably wrong.

 

CIS.png

 

 

 

 

 

 

 

 

 

If anyone would be able to help me figure out a way to sum the hours of each consumerUniqueID by month that would be very much appreciated and/or how to determine which consumer was able to meet the requirement of 3 face to face hours for any given month.

 

Thank you.

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @tmillerch ;

Try it.

Column = CALCULATE(SUM('Table'[Hour])/DISTINCTCOUNT('Table'[customerUnigueID]),FILTER('Table',[Month]=EARLIER('Table'[Month])))

or

Column 2 = CALCULATE(SUM('Table'[Hour]),FILTER('Table',[Month]=EARLIER('Table'[Month])&&[customerUnigueID]=EARLIER('Table'[customerUnigueID])))

The final show:

vyalanwumsft_0-1665020651592.png

If not right, can you share the result what you want to output and you logic?


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yalanwu-msft
Community Support
Community Support

Hi, @tmillerch ;

Try it.

Column = CALCULATE(SUM('Table'[Hour])/DISTINCTCOUNT('Table'[customerUnigueID]),FILTER('Table',[Month]=EARLIER('Table'[Month])))

or

Column 2 = CALCULATE(SUM('Table'[Hour]),FILTER('Table',[Month]=EARLIER('Table'[Month])&&[customerUnigueID]=EARLIER('Table'[customerUnigueID])))

The final show:

vyalanwumsft_0-1665020651592.png

If not right, can you share the result what you want to output and you logic?


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Shaurya
Memorable Member
Memorable Member

Hi @tmillerch,

 

I may have understood your problem partially only but this is what I think you want. The values in the Hour column should add up for all the rows with the same consumerUniqueID and Month.

 

Here's a DAX Formula to do that:

 

Sum of Hours = SUMX(FILTER('Table','Table'[consumerUniqueID]=EARLIER('Table'[consumerUniqueID])&&'Table'[Month]=EARLIER('Table'[Month])),'Table'[Hours])

 

Screenshot 2022-10-06 062948.jpg

 

Works for you? Mark this post as a solution if it does!

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.