Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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