Power BI: unique value (no duplicate) with distinctcount not showing the chart correctly
In Power BI, to not count duplicate values, I will use the distinctcount function allowing me to show only unique values but it may happen that the result is not displaying correctly, showing more than expected.
Imagine that I have this data:
I will create a column chart and I will put the month and the incident:
As we can see, it counts the duplicate in January so to avoid it, I will ask it to count distinct:
In January, it shows only 1 instead of 2, so this is correct but from October, it shows 1 and in my data, I have nothing for those last 3 months.
The reason for that, it is that the distinct count function is also counting the empty cells. To avoid it, I will have to create a measure by using the DISTINCTCOUNTNOBLANK function.
Then in the “Y-axis”, I will replace the “incident” by the “measure” and my chart will display correctly.
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...