To correct the error you can do this: if ATTR([matched]) == 'matched' THEN COUNT([district])
You could also do a calculation like this. IIF( [matched] = 'matched',1,0) The value of this will be the number of 'Matched' rows as well.
1 of 1 people found this helpful
Try putting your logic at row level then aggregate the results
countd(if [matched] = 'matched' then [district] end)
Not with filters -but you would try using sets - filters limit the data available to the worksheet - but sets create In and Out categories - its all there - it just has different classifications -
so if you can create sets on your different dimensions and then use the set interactions you might be able to do what you want -
Can't be more specific without seeing a twbx workbook
Though your first solution partially works, it would not display in the Total, because for the Total ATTR(matched) would return undefined
and your second solution would not return the countd but the count
In the first solution, you could switch out the ATTR with MIN or MAX
Thank you it worked!
---In the first solution, you could switch out the ATTR with MIN or MAX
Well this is true only if you have the dimension [matched] in the view.
But for the Total mark Tableau will execute the calculation on all rows without taking into account the granularity of the view.
So let say the matched dimension have 3 values aaa, matched and zzz.
ATTR would be undefined because there is not a unique value
MIN would return aaa , so not equal 'matched' and the count would return 0
Same thing with MAX which would return zzz
When possible we should always apply the logic at the row level and then aggregate.
This way, whether the dimension is in the view or not, the Countd will work