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
vincenardo
Helper I
Helper I

Count Values with condition

In my data set, I have multiple rows for each 'Name' when each 'Name; has a Skill:Name assigned to them, with a skill level, skill start date and skill end date;

 

2022-12-21_19-13-43.png

The end result I am trying to get to is to find out how many 'names' we have for each Skill:Name in the data set. In the above example, 'Calvin Lip' has 3 skills (Costco, Reface Sales Appt, Costco Bath - Sales Appt, and Bath Solutions Sales Appt). Becuase he has 4 skills, he would count as .25 in each (Count of Skill:Name by Name / 1).

 

The other caveat to the formula, is I only want to include the Skill:Name where the end date is NULL (IE: the skill is active) and where the skill level is NOT 1, as in this data set example;

 

2022-12-21_19-20-33.png

For Kevin, he would count as .50 in each (not counting the skill with an end date nor the skill level of 1.


Any suggestions are appreciated!

2 ACCEPTED SOLUTIONS

Hi,

Try these calculated column formulas

Count with condition = CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Name]=EARLIER(Data[Name])&&Data[Skill End Date]=BLANK()&&Data[Skill Level]<>1))
Apportioned count = if(and(Data[Skill End Date]=BLANK(),Data[Skill Level]<>1),DIVIDE(1,Data[Count with condition]),BLANK())

Hope this helps.

Untitled.png


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

View solution in original post

Thank you! This work perfectly!!

View solution in original post

5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

So For Calvin Lip, you want to see 0.25 in another column (in each of the 4 rows) and for Kevin, you want to see null, 0.5, 0.5 and null.  Am i correct?  Share the download link of the PBI file.


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

Hi,

Try these calculated column formulas

Count with condition = CALCULATE(COUNTROWS(Data),FILTER(Data,Data[Name]=EARLIER(Data[Name])&&Data[Skill End Date]=BLANK()&&Data[Skill Level]<>1))
Apportioned count = if(and(Data[Skill End Date]=BLANK(),Data[Skill Level]<>1),DIVIDE(1,Data[Count with condition]),BLANK())

Hope this helps.

Untitled.png


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

Thank you! This work perfectly!!

You are welcome.


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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.