Forum Discussion
DISTINCTCOUNT
- 5 years ago
Anonymous , Not very clear, if you are asking why total do not match, so distinct count is calculated again for total to that might not sum up.
to sum up you need
Measure = sumx(Values(DATA[Month]), CALCULATE(DISTINCTCOUNT(DATA[SerialNumber])))
or
Measure = sumx(summarize(DATA, DATA[Month], DATA[Model],"_1", CALCULATE(DISTINCTCOUNT(DATA[SerialNumber]))),[_1])
Here is the table and Desired Result for DISTINCT Count.
- ryan_mayu5 years ago
Super User
Anonymous
maybe you can create a column
count = if(CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Month]<=EARLIER('Table'[Month])&&'Table'[Model]=EARLIER('Table'[Model])&&'Table'[serialnumber]=EARLIER('Table'[serialnumber])))>1,0,1)and put the new column in the value field
- Anonymous5 years agoNot applicable
Thank you Ryan! Your recommended measure works great. However, if a unit(ServiceNumber) has been serviced twice in the same month, then the count shows ‘0’ instead of 1. Can it be fixed for it? Thanks again.
- Ashish_Mathur5 years ago
Super User
Hi,
Based on that data that you have shared, =distinctcount(data[serial number]) should return the correct result for every month. If not, then share the link from where i can download your PBI file.
- Anonymous5 years agoNot applicable
Thank you Ashish for taking a look. Here is the File Link.
- Ashish_Mathur5 years ago
Super User
Hi,
Try this measure
=
Count = if(HASONEVALUE(Data[Month]),DISTINCTCOUNT(Data[Model]),DISTINCTCOUNT(Data[SerialNumber]))Hope this helps.