March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I've built a measure that calculates what TopN peak times (hours) during the day we have max calls. This DAX spits out the times of the top 4 hours most calls were answered.
DAX Peak time Calls 4 hours =
VAR TotalSalesPerHour =
SUMMARIZE (
'Aggregated Daily',
'Aggregated Daily'[Time Hour],
"TotalCalls", [Calls measure]
)
VAR Result =
CONCATENATEX (
TOPN ( 4, TotalSalesPerHour, [TotalCalls] ),
'Aggregated Daily'[Time Hour],
", ",
[TotalCalls]
)
RETURN
Result
I now need to calculate the actual total number of calls, within just those top4 times. I tried editing the return variable but this didn't work:
Solved! Go to Solution.
DAX Peak time Calls 4 hours =
VAR TotalSalesPerHour =
SUMMARIZE (
'Aggregated Daily',
'Aggregated Daily'[Time Hour],
"TotalCalls", [Calls measure]
)
VAR Top4Hours =
TOPN ( 4, TotalSalesPerHour, [TotalCalls] )
VAR Top4HoursList =
SELECTCOLUMNS(Top4Hours, 'Aggregated Daily'[Time Hour])
VAR Result =
CALCULATE (
SUM('Aggregated Daily'[Calls measure]),
'Aggregated Daily'[Time Hour] IN Top4HoursList
)
RETURN
Result
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
DAX Peak time Calls 4 hours =
VAR TotalSalesPerHour =
SUMMARIZE (
'Aggregated Daily',
'Aggregated Daily'[Time Hour],
"TotalCalls", [Calls measure]
)
VAR Top4Hours =
TOPN ( 4, TotalSalesPerHour, [TotalCalls] )
VAR Top4HoursList =
SELECTCOLUMNS(Top4Hours, 'Aggregated Daily'[Time Hour])
VAR Result =
CALCULATE (
SUM('Aggregated Daily'[Calls measure]),
'Aggregated Daily'[Time Hour] IN Top4HoursList
)
RETURN
Result
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
This worked perfect, thank you!!
hi @nmckeown1 ,
try like:
DAX Peak time Calls 4 hours =
VAR TotalSalesPerHour =
ADDCOLUMNS(
SUMMARIZE (
'Aggregated Daily',
'Aggregated Daily'[Time Hour]
),
"TotalCalls", [Calls measure]
)
VAR _hours =
SUMMARIZE(
TOPN ( 4, TotalSalesPerHour, [TotalCalls]),
'Aggregated Daily'[Time Hour]
)
VAR Result =
CALCULATE(
[Calls measure],
'Aggregated Daily'[Time Hour] IN _hours
)
RETURN Result
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
115 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
164 | |
116 | |
63 | |
57 | |
50 |