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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Count of a column based on another filtered column.

I tried to search but couldn't find an apt solution here so i'm posting. I assume there must be a simple solution to this problem and my solution to the problem is having optimisation issues. This is kind of the famous Manager- Employee self join problem.

 

In Agile environment we have Portfolios with Initiatives associated to them. Some initiatives have Planviews associated with them. What i need is the count of Portfolios that are associated with Initiatives with a PlanviewID.

 

Please find the pic below for example:

 

image.png

 

Here we have initiatives I1, I3, I4 with Planviews. We need the count of Portfolio (column 1) which have Initiatives I1, I3, I4 (column 4). 

 

Here 4 portfolios that are associated to I2 and I5 but those initiatives dont have a planiewID so our final count is 6.

 

Note : This is just an excerpt and Portfolios can be repetitive based on some other items.

 

I created one calculated table

=CALCULATETABLE(VALUES(Agile[portfolio_id]),FILTER(Agile, Agile[Type] = "Initiative" && Agile[planview] <> BLANK()))

 

I got all the initiatives with Planview IDs. All i need now is occurances of these initiatives for distinct Portfolios.

 

P.S. - If its been solved here before kindly direct me to the page.

 

 

3 REPLIES 3
PattemManohar
Community Champion
Community Champion

@Anonymous Please try this as a new Measure.

 

Test31 = 
VAR _ValidInit = SUMMARIZECOLUMNS(Test31[Portfolio],FILTER(Test31,Test31[Planview]<>BLANK()))
VAR _Filter = FILTER(Test31,Test31[Initiative] IN _ValidInit)
RETURN COUNTROWS(_Filter)

image.png

 

Note - It will be great and helpful if you can post the sample data in copiable format.





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

Proud to be a PBI Community Champion




Anonymous
Not applicable

Since Portfolio's aren't repeated you could just add PlanView as a Card and change the Calculation to a Count from the "Fields" section. Then edit the Format, Disable the Category Label. Enable the Title. Then call it Count of Portfolio

 

Or create a measure like below and use that for the Card

Count of Portfolio = COUNT(Table2[PlanView])

Anonymous
Not applicable

@Anonymous Unfortunately this was just an excerpt and the Portfolio IDs can be repetitive based on some other items available. However Distinctcount won't give the right count with your DAX since it gives the output like :

 

(Portfolios with Initiatives) with PlanviewID

instead of 

Portfolio with (Initiatives with PlanviewID)

 


They both give different count.

 

I created one calculated table

=CALCULATETABLE(VALUES(Agile[portfolio_id]),FILTER(Agile, Agile[Type] = "Initiative" && Agile[plan_view_id] <> BLANK()))

 

I got all the initiatives with Planview IDs. All i need now is occurances of these initiatives for distinct Portfolios.

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors
Top Kudoed Authors