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! Learn more

Reply
RossKnorr
Frequent Visitor

Count unique IDs for teacher observations and include zero if there are no IDs for a teacher.

I'm finding it very difficult to summarize this problem in the subject line...

 

Hi Community,

 

In my query list I have two tables.

- One is a list of teachers with just one column: a list of teacher names.

- The second is a Sharepoint list that collects observations of these teachers with five yes/no questions per observation. I've unpivoted those yes/nos so that there are five rows for each observation. 

 

Not all teachers have received an observation, so there are names in the first table that don't exist in the second. Each observation in the second table has a unique ID number, and I want to create a chart on my Power BI report that will show the teacher name and the number of unique observations they had. However, I also want it to display the names of teachers who have had an observation yet, with a zero to show the number of observations.

 

I know how to do a distinct count to get the number of observations for teachers who HAVE had an observation (those that exist in the second table) and I think I need to join these two tables somehow to also show those with none, but I'm not sure how to do this and create the visualization I need.

 

Can anybody point me in the right direction?

 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @RossKnorr 

Based on your description, I created data to reproduce your scenario.
Teacher:

b1.png

Observation(after unpivot):

b2.png

 

Then you may create a measure as follows.

 

CountID = 
var _currentteacher = SELECTEDVALUE(Teacher[TeacherName])
var _count = 
CALCULATE(
    DISTINCTCOUNT(Observation[ID]),
    Observation[Teacher] = _currentteacher
)
return 
IF(
   _count = BLANK(),
   0,
   _count
)

 

 

Result:

b3.png

 

Best Regards

Allan

 

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

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @RossKnorr 

Based on your description, I created data to reproduce your scenario.
Teacher:

b1.png

Observation(after unpivot):

b2.png

 

Then you may create a measure as follows.

 

CountID = 
var _currentteacher = SELECTEDVALUE(Teacher[TeacherName])
var _count = 
CALCULATE(
    DISTINCTCOUNT(Observation[ID]),
    Observation[Teacher] = _currentteacher
)
return 
IF(
   _count = BLANK(),
   0,
   _count
)

 

 

Result:

b3.png

 

Best Regards

Allan

 

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

 

JarroVGIT
Resident Rockstar
Resident Rockstar

Hi @RossKnorr ,

You indeed need to create a relationship between the column of the first table and the teachername column of the second table. Then , create a table visual and drag first-table teacher name into it, and then the unique ID column from the second table into the visual. Change the summarization method under the list of columns of the visual:

image.png

Also check the "Show items with no data" in that menu and you have your solution 🙂 Let me know if this helps. (I assume you don't need help creating relationships, if you do please Google "how to create a relationship between tables power bi" and i am pretty sure the first few hits will explain it in detail :))

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





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

Proud to be a Super User!




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.

Top Solution Authors