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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
automated_user
Frequent Visitor

Find value in column and if found get Pseudo and Sum it by Year

Hi all,

 

Is there a way in power query to Find a value in another column, if found get the Pseudo of that row and keep it in a sum by year? For example, I have a table of records for each year and in these records is a column "PartNum". I want to find each instance a value in "PartNum" appears in the column "RowCount.PseudoLines" and if found get the "Pseudo" and keep a running total of that given year (sum). If it is not found, obviously the "SumByYear" column would have '0' as a value for that given "PartNum". See Table below:

 

automated_user_2-1667581896763.png

 

As seen MC55 would have a total sum of 2 for the year "2022" where MC01 was not found in the year "2019", hence had 0. 

 

Thanks

 

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @automated_user 

 

You can use the Merge Queries feature. First merge the current table to itself. Select "PartNum" and "FiscalYear" in the first table as matching columns (hold on Ctrl key to select multiple columns). Select "RowCount.PseudoLines" and "FiscalYear" in the second table. 

vjingzhang_0-1667810574082.png

 

After merging, click the expand icon on column header of the new table column and switch to Aggregate option. Select "Sum of Pseudo" in the list and click OK to expand. 

vjingzhang_2-1667811140917.png

 

After expanding, you will see null values on not found rows. Select that column and replace null with 0 via Transform > Replace Values. 

vjingzhang_3-1667811421701.png

 

I have attached a demo at bottom. You can download it to see details. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

 

View solution in original post

1 REPLY 1
v-jingzhang
Community Support
Community Support

Hi @automated_user 

 

You can use the Merge Queries feature. First merge the current table to itself. Select "PartNum" and "FiscalYear" in the first table as matching columns (hold on Ctrl key to select multiple columns). Select "RowCount.PseudoLines" and "FiscalYear" in the second table. 

vjingzhang_0-1667810574082.png

 

After merging, click the expand icon on column header of the new table column and switch to Aggregate option. Select "Sum of Pseudo" in the list and click OK to expand. 

vjingzhang_2-1667811140917.png

 

After expanding, you will see null values on not found rows. Select that column and replace null with 0 via Transform > Replace Values. 

vjingzhang_3-1667811421701.png

 

I have attached a demo at bottom. You can download it to see details. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.