Forum Discussion
countrows ignoring filter
- 5 years ago
Please try this small change instead. There is something called context transition that happens with you use a measure in your FILTER evaluation. It is a good thing but, since you are filtering the whole table, a filter is created on both columns and every row returns 1. That is what your first one gets all rows and your second one gets none. To get your desired result, you just want to filter the one column.
single transaction =
COUNTROWS(
FILTER (
DISTINCT ( N4_TruckTransactions[GATEVISITNUMBER] ),
[count nbr measure] = 1
)
)And then use same but with = 2 for second measure
Regards,
Pat
Please try this small change instead. There is something called context transition that happens with you use a measure in your FILTER evaluation. It is a good thing but, since you are filtering the whole table, a filter is created on both columns and every row returns 1. That is what your first one gets all rows and your second one gets none. To get your desired result, you just want to filter the one column.
single transaction =
COUNTROWS(
FILTER (
DISTINCT ( N4_TruckTransactions[GATEVISITNUMBER] ),
[count nbr measure] = 1
)
)
And then use same but with = 2 for second measure
Regards,
Pat
thanks Pat ,
it works!
šš
but can you explain a little more on
"a filter is created on both columns and every row returns"
still don't understand why first measure returns all rows and second returns blanks.
i first thought calculate() and filter() always goes together, but apperently not.
and when do I need to use the calculate() ?