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
Anonymous
Not applicable

Apply filters then Count Distinct observations

 

Hi,

 

I am trying to figure out how to count observations in a very particular way. my sample data and the resulting table I want to replicate in Power Bi are displayed in the image below.

 

I have a table of students who visited different schools in our district. I need need to count unique observations but I also need to give credit to each school for serving the student. In excel I do this by manually filtering the table by school year, school and month then counting the number of observations. I have tried myltiple dax formulas but have been unsussucessful in creating something that replicates this counting method. I want to have this in one visual just like I created in the excel sheet. Any help would be appreciated. Thanks

 

 

 

Power Bi Question.PNG

1 ACCEPTED SOLUTION
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please download the demo in the attachment. If you need the visual to show 0, a measure is needed.

ID Counts =
VAR temp =
    DISTINCTCOUNT ( Table1[Visitor ID] )
RETURN
    IF ( ISBLANK ( temp ), 0, temp )

Apply-filters-then-Count-Distinct-observations

 

Best Regards,
Dale

Community Support Team _ Dale
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

1 REPLY 1
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Please download the demo in the attachment. If you need the visual to show 0, a measure is needed.

ID Counts =
VAR temp =
    DISTINCTCOUNT ( Table1[Visitor ID] )
RETURN
    IF ( ISBLANK ( temp ), 0, temp )

Apply-filters-then-Count-Distinct-observations

 

Best Regards,
Dale

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

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