0

I'm trying to count rows based on filter in row called flag. I want to count only rows where flag is 1 or 2 and put that in variable since I'll need it for further calculation.

Sample data:

enter image description here

I have something like this so far but it's not working:

var average = CALCULATE(COUNTA(FILTER(table;[flag] = 1 && [flag] = 2)))

2 Answers 2

1

In the COUNTA function, you first must write the column you want to count. After, you apply the filter to the CALCULATE function (you don’t need the filter statement here):

var average = CALCULATE(COUNTA(table;[flag]); table[flag] = 1 && table[flag] = 2)
Sign up to request clarification or add additional context in comments.

2 Comments

Problem is && its implying both conditions have to be met. How do I put OR there?
Use || instead of &&
0

It worked with:

COUNTROWS(FILTER(table;[flag] == 1 || [flag] == 2))

thank you @Ivo for the tip about ||. I didn't manage to make it work with CALCULATE.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.