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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
bjs0026
New Member

Calculate Sum of Distinct Count

Hello,

 

I am trying to create the sum of a distinct count using either a new measure or a new column. Right now my formula is counting distinct days of the year (excluding weekends) to count the number of week days for the month, taking into account starts/terms. The formula works on an individual level, but when aggregated to the entire population it only returns the distinct count, and not the total number of weekdays for all individuals.

 

Capture.JPG

 

In the photo above, i want the total to be 11 for January and 87 for February. This will give me 98 total working days for this group.

 

End goal is to use these work days to get 'Total Possible Hours' (Days*8 hrs)

3 REPLIES 3
Greg_Deckler
Super User
Super User

This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hey Greg thanks for the response. I tried using your post, but I am getting the same result. It is still showing just the distinct value count, rather than the sum of those distinct counts.

 

Here is my formula:

 

 

DayofYear = CALCULATE(DISTINCTCOUNT('Time Date'[Day of Year]),NOT(ISBLANK('Time Date'[Day of Year])),USERELATIONSHIP('Time Date'[pse__Timecard__c],Timecard[Id]))
Measure 8 = SUMX( SUMMARIZE('Time Date','Time Date'[MonthAbr],"SUM",[DayofYear]),[DayofYear])

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.