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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
ZSF0003
Helper I
Helper I

Summing Distinct Counts

Hello,

I have a data set where I'm returning distinct values per day, but, for the weekly total, I would like to sum up those values. Here's the visual and DAX.

ZSF0003_0-1727881639004.png

 

And DAX

Sum of Distinct Counts =
    SUMX(
        SUMMARIZE(
            'Implementation Productivity',
            'Implementation Productivity'[CreateDt],
            'Implementation Productivity'[Branch Grouping],
            "DistinctCount",
            DISTINCTCOUNT('Implementation Productivity'[PTKey])
        ),
        [DistinctCount]
    )


As you can see, there is duplication between 'Count of Patients' and 'PT Count w/o Duplicates.' In the past, I've used DAX similar to achieve my goal but in this case, it is not working. As you can see, it mirrors the sum of non-distinct PT count. The expected value is 19 for the first row in the bottom visual because 6+4+2+3+4 = 19, then 11+20+20+21+15 = 87, and so on. The only filter I have on this sheet is a date filter that the DAX will need to react to. Any thoughts as to why the DAX is broken?

Thank you for your time

2 REPLIES 2
ZSF0003
Helper I
Helper I

I'm sorry. It did not solve the problem. That is why I did not accept it as a solution. 😞 Thank you for your time

Anonymous
Not applicable

Hi @ZSF0003 ,
Based on your description, I can't tell what structure your data is in. The following method is based on the example data I created.
Sample data
CategoryNameDateValue

A A1 23/9/2024 6
A A2 23/9/2024 11
A A1 24/9/2024 4
A A2 24/9/2024 20
A A1 25/9/2024 2
A A2 25/9/2024 20
A A1 26/9/2024 3
A A2 26/9/2024 21
A A1 27/9/2024 4
A A2 27/9/2024 15
B B1 23/9/2024 15
B B2 23/9/2024  
B B1 24/9/2024 3
B B2 24/9/2024 1
B B1 25/9/2024 10
B B2 25/9/2024  
B B1 26/9/2024 8
B B2 26/9/2024  
B B1 27/9/2024 6
B B2 27/9/2024  
C C1 23/9/2024 13
C C2 23/9/2024 9
C C1 24/9/2024 14
C C2 24/9/2024 8
C C1 25/9/2024 16
C C2 25/9/2024 5
C C1 26/9/2024 9
C C2 26/9/2024 3
C C1 27/9/2024 6
C C2 27/9/2024  

Create a mesure

Total of Name = 
CALCULATE(
    SUM('Table'[Value]),
    ALLEXCEPT(
        'Table',
        'Table'[Category],
        'Table'[Name]
    )
)

Final output

vheqmsft_0-1727918472774.png

 

Best regards,
Albert He


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

 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.