cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cgambino Frequent Visitor
Frequent Visitor

Count of rows after filtering by a measure

Hello,

 

I'm wondering how I could get the number of rows remaining after filtering.  I am currently using DirectQuery, and my filter is a measure using a DAX statement.

 

For example I have a table like so:

 

Name, Sales, Returns, PercentOfReturnedSales (measure)

 

George: 10, 1, 10%

Sam: 10, 5, 50%

Susan: 100, 5, 5%

Austin: 100, 85, 85%

Ron: 100, 1,1%

Alex: 100, 35, 35%

 

I have a filter that says "only show people who's percent of returned sales is over 15%"

 

So, in this example, it is 3 people. So I want it to show 3.

 

How would this be possible?

1 ACCEPTED SOLUTION

Accepted Solutions
cosborn1231 Regular Visitor
Regular Visitor

Re: Count of rows after filtering by a measure

Hi cgambino,

I hope this helps!

 

Measure = CALCULATE(DISTINCTCOUNT('Table'[Name]),FILTER('Table','Table'[PercentOfReturnedSales]>15))

2 REPLIES 2
cosborn1231 Regular Visitor
Regular Visitor

Re: Count of rows after filtering by a measure

Hi cgambino,

I hope this helps!

 

Measure = CALCULATE(DISTINCTCOUNT('Table'[Name]),FILTER('Table','Table'[PercentOfReturnedSales]>15))

Highlighted
twahl Frequent Visitor
Frequent Visitor

Re: Count of rows after filtering by a measure

Dose this function apply a grouping?  what I'm trying to do is group by a value to obtain a count of that value with applied filters. 

 

.  

Sql example. 

 

select column1, count(*) [#of records]

from table1

where column2 in ('filter1','filter2')

group by colum1

 

Thanks, 

tom