Forum Discussion
Measure to count calls in each queue
My measure doesn't split by the rows.
I only have one table in my model, so it has nothing to do with relationships. The total count I'm getting is correct. It just doesn't show a sub-count for each queue. I think the issue has something to do with one part of my measurement code where I filter out call_id where the queue is null.
There are both queue_key, and queue_display in my table. My two incorrect measures are using queue_key, Total calls don't have that filter part at all.
Total calls = CALCULATE(count(Calls[call_id]),
Calls[Event_type]="q",
Calls[Result_code] <> "d")
Answered incl. call-backs =
CALCULATE(COUNT(Calls[call_id]),
Calls[Event_type]="c",
Calls[Result_code] = "k",
Calls[Callback_in_queue] <> "a",
Calls[Queue_key] <> BLANK())
Offered calls = CALCULATE(count(Calls[call_id]),
Calls[Queue_key] <> BLANK(),
OR(
AND(
Calls[Event_type] = "c",
Calls[Callback_in_queue] <> "c"),
AND(
Calls[Callback_in_queue] = "a",
Calls[Result_code] <> "t")
)
)
Strange thing is that it works if I'm changing the column and use queue_display instead, as well as the other way around. My measure can use queue_display, but my visual table then has to use queue_key.
Why is this a thing and how do I fix it? I would like to only use queue_key or queue_display as they contain the same value of information.
- Anonymous4 years ago
Hi Anonymous ,
Here I create a sample to have a test.
When I try you code to create [Answered incl. call-backs] and [Offered calls] measures, I can reproduce your issue. Both measures will show total when I add [Queue_key] into the visual and show correct result when I add [Queue_display] into the visual. I think this should be caused by you use [Queue_key] <>BLANK() as independent filter. This seems to remove the filter of [Queue_key]. I suggest you to try codes as below.
Offered calls = CALCULATE ( COUNT ( Calls[call_id] ), FILTER ( Calls, Calls[Queue_key] <> BLANK () && OR ( AND ( Calls[Event_type] = "c", Calls[Callback_in_queue] <> "c" ), AND ( Calls[Callback_in_queue] = "a", Calls[Result_code] <> "t" ) ) ) )Answered incl. call-backs = CALCULATE ( COUNT ( Calls[call_id] ), FILTER ( Calls, Calls[Event_type] = "c" && Calls[Result_code] = "k" && Calls[Callback_in_queue] <> "a" && Calls[Queue_key] <> BLANK () ) )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 Replies
- AnonymousNot applicable
Hi Anonymous ,
Here I create a sample to have a test.
When I try you code to create [Answered incl. call-backs] and [Offered calls] measures, I can reproduce your issue. Both measures will show total when I add [Queue_key] into the visual and show correct result when I add [Queue_display] into the visual. I think this should be caused by you use [Queue_key] <>BLANK() as independent filter. This seems to remove the filter of [Queue_key]. I suggest you to try codes as below.
Offered calls = CALCULATE ( COUNT ( Calls[call_id] ), FILTER ( Calls, Calls[Queue_key] <> BLANK () && OR ( AND ( Calls[Event_type] = "c", Calls[Callback_in_queue] <> "c" ), AND ( Calls[Callback_in_queue] = "a", Calls[Result_code] <> "t" ) ) ) )Answered incl. call-backs = CALCULATE ( COUNT ( Calls[call_id] ), FILTER ( Calls, Calls[Event_type] = "c" && Calls[Result_code] = "k" && Calls[Callback_in_queue] <> "a" && Calls[Queue_key] <> BLANK () ) )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Thank you, I feel like I tried just everything. Never had anything like this before.