0

I have three columns in my table: A - event values that user does on an app B - success or error C - unique ID - used for counting totals

I want to find out the count of events in A, when there is at least one error in B.

I have a measure: c-events = countrows of C. If i run this code: Error Events = CALCULATE([C-events], FILTER(Query1, Query1[B]="error")) Then I get 2 as the number, but I want to get 6 as the answer, since I want to get the total of all values in A that had at least 1 error in B. Any thoughts on how I could do it in Dax?

1 Answer 1

1

So if I am understanding correctly based on the image you provided, you are essentially looking to sum the values in C where the value of B is error? If so, I think this should work:

Error Events = CALCULATE(SUM([C-events]), FILTER(Query1, Query1[B]="error"))
Sign up to request clarification or add additional context in comments.

2 Comments

Hey Joe, thanks so much for looking into this, however, sum([C-events]) is erroring out, since C-events is a measure and not a column.
@nukalanagendra COUNTROWS looks at a whole table rather than a column, so the reason why you're getting a value of two using c-events is because there are two rows in the table that contain B value of error. If you were looking for the sum of values in C when B=Error, try this: Error Events = CALCULATE(SUM('Query1'[C]), FILTER('Query1', [B]="error"))

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.