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

Dax Calculated Column to Count Number of Patients

Hello,

I have two data tables, one with a distinct list of medical practices and one with a list of patients that belong to that practice along with when they were enrolled or if they've disenrolled in our program. I need to get a count of the number of patients at each practice for billing purposes. It must be done in DAX rather than in Power Query because the date range will change , and therefore, the number of active patients at the time of billing will change. Below is an example of each table and the results I am trying to achieve.


Practice Table:

Practice NamePracitce ID
Practice 1 Name45
Practice 2 Name29

 

Patient Table:

Patient NamePractice ID
Patient A 45
Patient B 45
Patient C 29

 

Final Practice Table:

Practice NamePractice IDNumber of Patients
Practice 1 Name 45 2
Practice 2 Name 29 1
6 REPLIES 6
lukiz84
Memorable Member
Memorable Member

amit he want's to slice from and to dates, the calculated column won't help here...

amitchandak
Super User
Super User

@Anonymous , A new column in Practice table

 

countx(filter(Patient , Patient[Practice ID] = Practice [Practice ID]),Patient[Practice ID])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
lukiz84
Memorable Member
Memorable Member

Where is the date from/to?

 

 

Anonymous
Not applicable

The enrollment from and to dates are in the patient table. They're being used as a slicer on the report. I should note, that I inherited this report and don't currently have permission to alter the data layout.

no need to alter it, i figured it would be in Patient table, makes the most sense here. Do you have a seperate date table in place or do you want to set the slicers on the Date from / To fields?

 

 

Anonymous
Not applicable

I'd like to set it on the from to fields

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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 Kudoed Authors