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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
mabuzaid1993
New Member

New column to Count one to many

Hi im super new to power bi , 

The structure i have is 2 tables , programs and projects .

I need a simple new column in my programs table that counts the amount of projects for each program that i have

knowing that i have a one to many relationship with 1 program that have many projects.

 

 

 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

NewColumn=COUNTROWS(RELATEDTABLE(Projects))

View solution in original post

2 REPLIES 2
wdx223_Daniel
Super User
Super User

NewColumn=COUNTROWS(RELATEDTABLE(Projects))

KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @mabuzaid1993 ,

 

I do understand that you're new to Power BI, and I will do my best to explain the step as clearly as possible.

There are a few ways you can achieve the outcome:

 

Method 1: 

1. Reference projects table, then apply "Group by" function to do the count.

How to use group by: Grouping or summarizing rows - Power Query | Microsoft Docs

 

Merge the above table from step 1 to the program table.

How to merge table: Merge queries overview - Power Query | Microsoft Docs

 

Method 2: Add a Custom Column and apply the formula below

 

 Table.SelectRows(ProjectTableName, each (x)=> (x[ProjectTableColumnName] = [ProgramTableColumnName]) and (x[ProjectTableColumnName] = [ProgramTableColumnName])

 

Condition1

Condition2

You can add more conditions, joining conditions with and / or.

 

If all the above does not make sense or does not meet your expectation.

Please kindly share some sample data with sensitive information removed, and a specific solution can be provided.

 

Regards

KT

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors