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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors