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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Question: use the detailed family report and show the family size for each id

Hi Team,

I have a request that I have the original family report with detailed relations to the related ID. the final results I would like to have in Power BI is to show the total ID with the different family size by chart. Could someone help me how to make it?

I attached an sample for dummy data: the original data are the details family data with mutiple ID, I would like to create a new table with single ID plus the related number of familys and then use the different family size as the row and count the ID.  the final chart is like the last one.  I am not sure if there is any direct way to the chart without cover the table.

Thank you,

CAOLU10_0-1739247380163.png

IDNameRelations
1234ABCDaughter
1234ABCSon
1234ABCDaughter
2345CDASon
1245ACDSon
2341AADSon
1245ACDSon
1245ACDSon
2341AADSon
2341AADDaughter
1234ABCSpouse

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from Ashish_Mathur  and danextian , please allow me to add some more information:
Hi  @Anonymous ,

Here are the steps you can follow๏ผš

If you don't want to create a table for the effect, you can just create a calculated column:

Count of Records =
COUNTX(
    FILTER('Table',[ID]=EARLIER('Table'[ID])),[Relations])

vyangliumsft_0-1739342827314.png

Place [ID] to Y-axis and set it to Count(Distinct), place [Count of Records] to X-axis.

Set X-axis - Categorical

vyangliumsft_1-1739342870788.png

vyangliumsft_2-1739342870794.png

If you want to create a calculation table to achieve the effect, consider the following steps:

Create calculated table.

Table 2 =
SUMMARIZE(
    'Table',
    [ID],"Count of Relations",COUNTX('Table',[Relations]))

vyangliumsft_3-1739342894467.png

Place [ID] to Y-axis and set it to Count, place [Count of Records] to X-axis.

vyangliumsft_4-1739342894473.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Thanks for the reply from Ashish_Mathur  and danextian , please allow me to add some more information:
Hi  @Anonymous ,

Here are the steps you can follow๏ผš

If you don't want to create a table for the effect, you can just create a calculated column:

Count of Records =
COUNTX(
    FILTER('Table',[ID]=EARLIER('Table'[ID])),[Relations])

vyangliumsft_0-1739342827314.png

Place [ID] to Y-axis and set it to Count(Distinct), place [Count of Records] to X-axis.

Set X-axis - Categorical

vyangliumsft_1-1739342870788.png

vyangliumsft_2-1739342870794.png

If you want to create a calculation table to achieve the effect, consider the following steps:

Create calculated table.

Table 2 =
SUMMARIZE(
    'Table',
    [ID],"Count of Relations",COUNTX('Table',[Relations]))

vyangliumsft_3-1739342894467.png

Place [ID] to Y-axis and set it to Count, place [Count of Records] to X-axis.

vyangliumsft_4-1739342894473.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

Hi Liu yang, thanks for your detailed instruction and I think this solution is the better one that I do not need to create the new table and functions. thank you

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1739329704955.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @danextian  

Thank you so much for your quick response, this helps me a lots. I will try it and thanks also for the BI file which is easier for me to see the details. 

Lu

danextian
Super User
Super User

Hi @Anonymous 

 

The first table would be as simple as counting the rows in the table.

Count of Records = 
COUNTROWS ( 'Table' )

danextian_1-1739250523351.png

Please see the attached pbix.

 

For the second table, you can create a calculated table to count the rows for each ID.

Family Size = 
-- Calculate the family size by counting the number of rows
-- where the ID column in the 'Table' matches the current row's ID
COUNTROWS ( 
    FILTER ( 
        'Table', 
        'Table'[ID] = EARLIER ( 'Table'[ID] ) 
    ) 
)

And then a measure to count the distinct IDs

Distinct ID = 
DISTINCTCOUNT ( 'Table'[ID] )

Add the family size column and Distinct ID measure to the visual.

 

danextian_0-1739250503494.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and Iโ€™ll forget; show me and I may remember; involve me and Iโ€™ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.