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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
sam01454
Frequent Visitor

Represent count across another count

Hi, I have a table that has the account id and the device id associated with the account. One account can have multiple devices. I want to represent how many accounts have 1 devices, how many accounts has 2 devices and so on. I am not able to represent the count(account) across count(device) in a bar graph in direct query mode. The sql will look something like this: select A.dvc, count(A.account) (select account, count(devices) as dvc from table) A Thanks

4 REPLIES 4
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @sam01454 

You may drag the account id and device id columns as below when creating the bar graph.

1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

This didn't work, it is just giving two count, the device count is not coming in the x axis.

Hi @sam01454 

If you want to get the count and use it in x-axis.You may get the count columns and use them.I would suggest you create a new table with SUMMARIZE function like below.Then drag the count columns to x-axis.

Table2 =
SUMMARIZE (
    'Table',
    'Table'[account id],
    'Table'[device id],
    "Count1", COUNT ( 'Table'[account id] ),
    "Count2", COUNT ( 'Table'[device id] )
)

For further,please refer to below article.

https://www.sqlbi.com/articles/best-practices-using-summarize-and-addcolumns/

For 3rd party Links:
Please understand that this link is provided “AS IS” with no warranties or guarantees of content changes, and confers no rights.

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @sam01454 

Could you tell me if your problem has been solved? If it is,kindly mark the helpful answer as a solution and welcome to share your own solution. More people will benefit from here. If not, please share more details for us so that we could help further on it.You can upload the .pbix file to OneDrive and post the link here. Do mask sensitive data before uploading.

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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