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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

Count Number of IDs within a Call

Hi, I am trying to add up the number of calls that have so many IDs attached to them. So, for example 4 calls had 3 IDs attached to them, and so on. I am not sure how to display this in Power BI. I was hoping a Matrix would figure it out for me  but this is what I got: 

cbtekrony_0-1710362131863.png

One call could have several IDs attached to it, or just one. So, out of the 7,617,384 calls, I'm trying to display that for example 100,000 of them had 3 IDs attached to them, 75,000 had 4 IDs, etc....can't figure out how to show this. 

4 REPLIES 4
vicky_
Super User
Super User

I created a new table (basically just number 1, 2, ... n), then used a measure to calculate the number of calls attached to an ID -

Count of IDs = 
var temp = ADDCOLUMNS(VALUES('Table'[Ids]), "countIds", CALCULATE(COUNT('Table'[Ids])))
return COUNTROWS(FILTER(temp, [countIds] = SELECTEDVALUE(Frequency[Value])))

vicky__0-1710370705615.png

 

Anonymous
Not applicable

@vicky_ Thanks. Not sure if I've done this right since this is a new one for me. Here is the DAX based on what you said (I wasn't sure about what "Frequency[value]" was). 

 

Count of IDs =
var temp = ADDCOLUMNS(VALUES('table'[ID]), "countIds", CALCULATE(COUNT('table'[ID])))
return COUNTROWS(FILTER(temp, [countIds] = SELECTEDVALUE('table'[CALL])))

 

I got the error message: Couldn't load the data for this visual because DAX does not support comparing values of integer with values of text. I am not sure where in this DAX I need to fix this (the CALL and ID data must be stored as text because they both have letters in their codes). 

SELECTEDVALUE('table'[CALL]) is the part that's not working. 
In my DAX, i've created a new table called Frequency with a column called Value - that is what i'm using in my equation, not the call string. If you still have trouble, please add some sample data.

Anonymous
Not applicable

@vicky_ I appreciate your help. Can you share with me the DAX for the table you created? I think I'm confused because in the illustration at the top it looks like you have a column Frequency and a column Value. I am not sure how those two are interacting with each other (if they are). Thanks!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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