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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
KAJAR
New Member

SUM total number of calls per phone number above 2 calls

Hi there! 

I keep running my head against the wall with this one and would love any kind of help 😄

Goal:

A single measure I can put on a "Card" in Power BI that shows the total number of calls for all phone numbers that have called above 2 times. 

 

Source = phone number
CallAnswered = 1's (if a number have called there is a new row inserted)

 

I've tried this:

 

KJ - SUM kald source = CALCULATE(
    SUM(CallEvents[CallAnswered]),
    FILTER(
        SUMMARIZE(
            CallEvents,
            CallEvents[source],
            "Total Calls", COUNT(CallEvents[CallAnswered])
        ),
        [Total Calls] >= 3
    ),
    ALL(CallEvents)
)
 
But it still includes numbers that have less than 3 calls in total.
 
I've also tried this:
KJ - SUM kald source = CALCULATE(
    SUM(CallEvents[CallAnswered]),
    FILTER(
        SUMMARIZE(
            CallEvents,
            CallEvents[source],
            "Total Calls", COUNT(CallEvents[CallAnswered])
        ),
        [Total Calls] >= 3 && [Total Calls]<3
    ),
    ALL(CallEvents)
)
 
But this excludes all phone numbers both the numbers that have recieved over and under 2 calls in total.
 
What am I missing here? 
I appriciate any help 😄
1 ACCEPTED SOLUTION

I hadn't included a filter to check that CallAnswered is 1.

Total calls with more than 2 calls =
VAR SummaryTable =
    ADDCOLUMNS (
        VALUES ( 'CallEvents'[source] ),
        "@num calls", CALCULATE ( COUNTROWS ( 'CallEvents' ), 'CallEvents'[Call Answered] = 1 )
    )
VAR Result =
    SUMX ( FILTER ( SummaryTable, [@num calls] >= 3 ), [@num calls] )
RETURN
    Result

View solution in original post

6 REPLIES 6
tamerj1
Super User
Super User

Hi @KAJAR 
Please try

KJ - SUM kald source =
SUMX (
    FILTER (
        SUMMARIZE (
            CallEvents,
            CallEvents[source],
            "Total Calls", SUM ( CallEvents[CallAnswered] )
        ),
        [Total Calls] >= 3
    ),
    CallEvents[CallAnswered]
)

Thanks for the reply @tamerj1.
I saw it after @johnt75 solved it, but thank you so much! 

johnt75
Super User
Super User

Try

Total calls with more than 2 calls =
VAR SummaryTable =
    ADDCOLUMNS (
        VALUES ( 'CallEvents'[source] ),
        "@num calls", CALCULATE ( COUNTROWS ( 'CallEvents' ) )
    )
VAR Result =
    SUMX ( FILTER ( SummaryTable, [@num calls] >= 3 ), [@num calls] )
RETURN
    Result

Hi johnt75! Thanks for your reply. 

 

It no longer includes below 2 calls, but now it has 400.000 more calls as total than it should. Did I do something wrong? 

KAJAR_1-1682420743570.png

 

The two totals marked with yellow is the actual total (depending on if calculated over/under a cetain time limit) 

I hadn't included a filter to check that CallAnswered is 1.

Total calls with more than 2 calls =
VAR SummaryTable =
    ADDCOLUMNS (
        VALUES ( 'CallEvents'[source] ),
        "@num calls", CALCULATE ( COUNTROWS ( 'CallEvents' ), 'CallEvents'[Call Answered] = 1 )
    )
VAR Result =
    SUMX ( FILTER ( SummaryTable, [@num calls] >= 3 ), [@num calls] )
RETURN
    Result

Thank you so much - It's working perfect!

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors