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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
wiboc
Frequent Visitor

Problem showing & countnig field from related table

I have not been able to count & show unique fields from related table.

relations:

request-zispatient 

visual:

table request * patient number (from ZisPatient) 

 

Hoi can I countthe number of request from unique patient (not 10 but 6). 

Is het also possible to show the table with unique patient - requests?

 

oh, Iúsing direct query on sql-server

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @wiboc ,


According to the data model you provided, I did the following tests and returned the expected results:

 

v-henryk-mstf_0-1615876154455.png

M =
CALCULATE ( DISTINCTCOUNT ( Zispatient[patientNumber] ), ALL ( Zispatient ) )

v-henryk-mstf_1-1615876218412.png

If the problem still cannot be solved, please refer to the use of the ALL function, clear the external filter conditions, and then check whether the result is displayed correctly.

v-henryk-mstf_2-1615876395888.png


Let me know immediately, looking forward to your reply.


Best Regards,
Henry


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

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @wiboc ,


According to the data model you provided, I did the following tests and returned the expected results:

 

v-henryk-mstf_0-1615876154455.png

M =
CALCULATE ( DISTINCTCOUNT ( Zispatient[patientNumber] ), ALL ( Zispatient ) )

v-henryk-mstf_1-1615876218412.png

If the problem still cannot be solved, please refer to the use of the ALL function, clear the external filter conditions, and then check whether the result is displayed correctly.

v-henryk-mstf_2-1615876395888.png


Let me know immediately, looking forward to your reply.


Best Regards,
Henry


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

PC2790
Community Champion
Community Champion

You can try a DAX measure to count distinct values only, something like:

disctinctcount = DISTINCTCOUNT([patientNumber])

 

wiboc
Frequent Visitor

it doesn work because every row shows and counts the requests...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

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.