Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
nmckeown1
Helper I
Helper I

TopN Ranked times of calls

I'm trying to return a list of the top 4 time hours of calls answered.

I have a measure for the MAXX peak time, but want to include the top 3 and return the associated Time, as opposed to the actual value of sum of calls.

 

nmckeown1_0-1730888737602.png

 

The Peak time measure works fine as below: But only spits out the one max time. The table above is filtered for ranking 1-4, so I would like a measure for ranking 2, ranking 3 and ranking 4, so I  can include it in a statment. And say "The top peak times of calls was 2pm, 4pm, 1p, 11am and 3pm.

 

DAX Peak time Calls =
VAR Totalsalesperhour =
SUMMARIZE('Aggregated Daily','Aggregated Daily'[Time Hour], "TotalCalls",[Calls measure])
VAR MaxSales = MAXX(Totalsalesperhour,[TotalCalls])
RETURN
CALCULATE(
    MAX('Aggregated Daily'[Time Hour]),
    FILTER(Totalsalesperhour,[TotalCalls] = MaxSales)
)
1 ACCEPTED SOLUTION
johnt75
Super User
Super User

Create a measure like

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

This will return more than 4 rows in the event of ties.

View solution in original post

3 REPLIES 3
nmckeown1
Helper I
Helper I

Following on from this above... if I now have the returned top 5 peak times of calls coming in. To also calculate the actual total number of calls, within the calculated top5 time frames: see below:

 

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

johnt75
Super User
Super User

Create a measure like

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

This will return more than 4 rows in the event of ties.

This worked perfect!!

Thank you

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.