Why is my Count (distinct) not working the way I would expect it to be? PowerBI

My total is set as Count (distinct). However, the total itself doesn't make any sense, as you can see in my attachment. Any ideas what I'm doing wrong? By not making any sense, I mean that the numbers above are not being added.

Any suggestions would be greatly appreciated.

Topic powerbi

Category Data Science


Count distinct is a measure (aggregate function). When the measure is used in the total row, it is not summing the distinct count values about but is calculating the function in the context of all the table data. Without seeing the data I would make the assumption that there are 85 distinct values between those 4 months. March, for example, happens to contain 83 of 85 of those values.

If you want a sum of the values above, you can use SUMX.

Example:

Count of ProjectName = 
SUMX (
    VALUES ( 'put table name here'[MonthNameShort] ),
    CALCULATE ( DISTINCTCOUNT ( 'put table name here'[ProjectName] ) )
)

Comparison in Power BI: distinct count versus sumx with distinct count

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.