Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello there
I am actually working with Callcenter-Data.
I need help to create measures returning
... the name of the CC-Agent with the Max Number of Calls per week
... the name of the CC-Agent with the Min Number of Calls per week
Each should be displayed on a Card Visual
One problem is that I do not find a way to calculate the max with a direct use of a metric figure (I countrows(facts) which represents the incoming phone number), but MAX() requires a table, not an aggregate.
My Measure does not work
MaxCallPerAgent =
VAR vTbl = ADDCOLUMNS( dimAgents, "@Calls", [#Calls] )
VAR vMax_v1 = MAX( dimAgents[@Calls] ) -- does not work, no field [@Calls in table]
VAR vMax_v2 = MAX( vTbl[@Calls] ) -- does not work, vTbl not allowed
VAR Max_Topn = TOPN(1, vTbl, [@Calls], DESC ) -- gives no scalar value
RETURN
???
I have tried some approaches but unfortunately I do not succeed
The link leads to a pbix on my OneDrive with a reduced datamodel.
Your help is appreciated.
Thx & brgds
Thomas
Solved! Go to Solution.
Hi @thomasreick
Here are some variations on how you can create such a measure (modified PBIX attached).
Showing examples for Agent with Max # Calls:
Agent with Max Calls FIRSTNONBLANK TOPN =
-- FIRSTNONBLANK breaks ties by choosing first Agent lexicographically in the case of ties
FIRSTNONBLANK (
TOPN ( 1, VALUES ( dimAgents[AgentName] ), [#Calls] ),
0
)
Agent with Max Calls CONCATENATEX TOPN =
-- CONCATENATEX concatenates multiple AgentNames in the case of ties
CONCATENATEX (
TOPN ( 1, VALUES ( dimAgents[AgentName] ), [#Calls] ),
dimAgents[AgentName],
", ",
dimAgents[AgentName]
)
Agent with Max Calls FIRSTNONBLANK INDEX =
-- FIRSTNONBLANK breaks ties by choosing first Agent lexicographically in the case of ties
FIRSTNONBLANK (
INDEX (
1,
VALUES ( dimAgents[AgentName] ),
ORDERBY ( [#Calls], DESC )
),
0
)
Here is an example of the values returned in your sample PBIX when filtered on ISO Week 202402 where there is a tie for agent with Min calls:
This is a good article on this topic:
https://www.sqlbi.com/articles/alternative-use-of-firstnonblank-and-lastnonblank/
Regards
Hello Owen, thank you very much for both..., the source to learn from and the pbix to work with.
Works fine and the topic is solved.
Thomas
Hi @thomasreick
Here are some variations on how you can create such a measure (modified PBIX attached).
Showing examples for Agent with Max # Calls:
Agent with Max Calls FIRSTNONBLANK TOPN =
-- FIRSTNONBLANK breaks ties by choosing first Agent lexicographically in the case of ties
FIRSTNONBLANK (
TOPN ( 1, VALUES ( dimAgents[AgentName] ), [#Calls] ),
0
)
Agent with Max Calls CONCATENATEX TOPN =
-- CONCATENATEX concatenates multiple AgentNames in the case of ties
CONCATENATEX (
TOPN ( 1, VALUES ( dimAgents[AgentName] ), [#Calls] ),
dimAgents[AgentName],
", ",
dimAgents[AgentName]
)
Agent with Max Calls FIRSTNONBLANK INDEX =
-- FIRSTNONBLANK breaks ties by choosing first Agent lexicographically in the case of ties
FIRSTNONBLANK (
INDEX (
1,
VALUES ( dimAgents[AgentName] ),
ORDERBY ( [#Calls], DESC )
),
0
)
Here is an example of the values returned in your sample PBIX when filtered on ISO Week 202402 where there is a tie for agent with Min calls:
This is a good article on this topic:
https://www.sqlbi.com/articles/alternative-use-of-firstnonblank-and-lastnonblank/
Regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
76 | |
53 | |
46 | |
16 | |
12 |