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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jbernard82
New Member

Help with measure

I've got a table full of call records and I am creating a matrix to display total incoming calls and outgoing calls for each extension selected in the slicer. I wrote the following or the measure thinking that it would filter using the slicer only the values I need.

 

Calls In = COUNTROWS(FILTERS(Calls[ToNumber]))

For each individual selected in the slicer it shows the same number which I figured out is the total distinct values from the dataset instead of the total for each person selected in the slicer. I know Im missing something I just can't pinpoint the problem.

 

1 ACCEPTED SOLUTION

My suggestion that is what I would do ( although don't know your other visuals ) is to create an active relantionship Extension -  ToNumber  and inactive relantionship with Extension - FromNumber..The measures can be 

 

Calls in = COUNTROWS( Calls )

Calls Out =
CALCULATE (
    COUNTROWS ( Calls );
    USERELATIONSHIP ( Extensions[Extension]; Calls[FromNumber] )
)

This way you won't have to change your visual or your model.

 

 

 

 

 

 

 

Konstantinos Ioannou

View solution in original post

11 REPLIES 11
konstantinos
Memorable Member
Memorable Member

Just use

Calls In = COUNTROWS( Calls )

 

Konstantinos Ioannou

That returns all calls. I am trying to use a slicer to view calls for specific users.

If you put the measure described by @konstantinos in the values section of the matrix and put the person details in the rows section you should get a count for each person.

 

If that doesn't work you may have a problem with your linking between tables, do you have a "relationships may be needed" warning above your field list?

When I do that I still get the same total call count for everything. I dont have any relationship errors but I had to change my model because the Calls table has a ToNumber and FromNumber and I cannot have two active relationships with the Extension column on the other table. Here is my current model.

My suggestion that is what I would do ( although don't know your other visuals ) is to create an active relantionship Extension -  ToNumber  and inactive relantionship with Extension - FromNumber..The measures can be 

 

Calls in = COUNTROWS( Calls )

Calls Out =
CALCULATE (
    COUNTROWS ( Calls );
    USERELATIONSHIP ( Extensions[Extension]; Calls[FromNumber] )
)

This way you won't have to change your visual or your model.

 

 

 

 

 

 

 

Konstantinos Ioannou

The challenge with an inactive relationship is that @jbernard82 is using a slicer to filter the extension and then wants to see outbound and inbound calls for each extension. A slicer will always use the active relationship, so if an extension has only ever been a FromNumber, it would get filtered out. 

 

For that reason, I'd tend to agree with @itchyeyeballs regarding unpivoting the call data. 

 

If the filtering out wouldn't be an issue though, then an inactive relationship is definitely a more straightforward solution to the immediate problem of counting calls.

---
In Wisconsin? Join the Madison Power BI User Group.

Thanks @konstantinos! That did the trick. The slicer does still appear to work with the inactive relationship.

It looks like there may be an issue with your model, does the  "total calls by ext..." table combine the calls in and out?

 

If so using it to link through to the extentions table may cause issues.

 

Try changing the link from calls table to link directly to extensions.

 

I find this quite useful to describe how to set up tables and links - http://www.powerpivotpro.com/2015/10/giving-back-steal-this-reference-card/

 

 

 

The total calls by extensions does a union of a select all toNumber and FromNumber rows where they involve an internal extension so there could be two rows with the same CallID but two different extensions when two people call each other in the office.

 

Moving the relationship from the ToNumber on the Calls table directly to the Extensions table fixed it. The problem is I cannot add another relationship from the FromNumber to the Extentions table because it cannot have multiple relationships on the same column in the Extension table for the Calls Out measure.

I guess I could just duplicate the Calls table just to get the relationship for this to work but that could mess up other visuals unless creating a relationship between the two on the CallID field would take care of that. Thoughts?

You need to get your model right before you go any further otherwise your measures will become ever more complex to get around underlying issues.

As mentioned in your other thread, I would look at unpivoting the calls table so that incoming and out going calls are separate rows. If every call has a unique Id you can avoid double counting internal calls by filtering in your measures

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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