Forum Discussion
Count distinct value with condition in column
- 6 years ago
Hi Anonymous ,
We can use the following steps to meet your requirement.
1. Create a measure to calculate the distinct count value and the value is greater than 15.
Measure = CALCULATE(DISTINCTCOUNT(A[Value]),A[Value]>15)2. Then we can put the measure to filter on this visual and filter TOP 5 name.
The result like this,
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
BTW, pbix as attached.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Create a measure like this
Value GT = Calculate(Sum(Table[Value]),Table[Value]>15)
Use a visual level filter to take the top 5 Name based on the value
Ord create a rank and use that in a filter of the visual level filter
Rank = rankx(all(Name),[Value GT ],,dese,dense)
For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
- Anonymous6 years agoNot applicable
Dear amitchandak ,
The problem is that my data table has a lot of records, the number of distint names is over 200, I can't create each Measure to count each Name, this can be easily handled if using a custom column to store the number for each Name, but I need to use Measure so that the chart can work with Slicer.
I can get a list of distinct names, but how do I use the Measure to count the number for each name distinct?
- amitchandak6 years agoSuper User
Anonymous , You can create a table with a distinct name and join the other table with that. You can always use count distinct from name table
Name = distinct(Table[Name])
- Anonymous6 years agoNot applicable
I created Table B with Distinct Name from Table A, I can also count the number of Distinct Names with CALCULATE COUNTROWS, but so the Slicer I use to filter Year will not work.
Please check my pbix file.