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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
acg
Resolver I
Resolver I

Top 10 most called numbers by number of calls and Top 10 most called numbers by duration of call

I have phone_numbers that were called over time, how often they were called and the duration of each call. 

I need two calculations:

1) Top 10 most called numbers by number of calls received

2) Top 10 most called numbers by duration of call

 

the varibles I have: Phone_Number , date, call_duration

What DAX can I write to resolve these two calculations?

For Question 1) Top 10 most called numbers by number of calls received: I tried:

                           Top 10 can be resolved with the filter. 

                     
CNT Calls =
CALCULATE (
DISTINCTCOUNT( table[Phone_Number]),
FILTER ( table, table[date])
)

 

What do I need to change as my count is not correct. The date? How can I write this?

For Question 2) Top 10 most often called numbers by duration of call: I tried:

                           Top 10 can be resolved with the filter. 

 

CNT of Calls by Duration=
COUNT(
DISTINCTCOUNT( table[Phone_Number]),
FILTER ( table, table[duration])
)

 

What do I need to change to get the calls by duration?

How can I implement a second filter, say I want only County= AUS ?

 

Thank you, I am still new to DAX and still find it challenging to get used to. 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@acg , TRy measures like these

 

calls = count( table[Phone_Number])
Total Duration = Sum(table[duration])

TOP 10 by call = calculate([calls],TOPN(4,allselected(table[Phone_Number]),[calls],DESC), values(table[Phone_Number]))


Top 10 by duration = calculate([Total Duration],TOPN(4,allselected(table[Phone_Number]),[Total Duration ],DESC), values(table[Phone_Number]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@acg , TRy measures like these

 

calls = count( table[Phone_Number])
Total Duration = Sum(table[duration])

TOP 10 by call = calculate([calls],TOPN(4,allselected(table[Phone_Number]),[calls],DESC), values(table[Phone_Number]))


Top 10 by duration = calculate([Total Duration],TOPN(4,allselected(table[Phone_Number]),[Total Duration ],DESC), values(table[Phone_Number]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I am having trouble to incorporate the Measure: CNT To_Person

and receive the mistake as below. Is the measure at the right place?

 

 

CNT To_Person = Count ('mobile mobile_network_calls'[To_Person])
 
TOP10_by_Call =
CALCULATE([CNT To_Person],TOPN(10,ALLSELECTED('mobile mobile_network_calls'[To_Person],
[CNT To_Person],DESC),VALUES('mobile mobile_network_calls'[To_Person])))
 
And I receive for   [CNT To_Person],DESC
the follwing mistake:
The ALLSELECTED function expects a table reference expression for argument '2', but a string or numeric expression was used.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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