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
Tadadada
New Member

How to Count in DAx

I have a table with MonthNum and patients. I want to count patient per month using month number.

Thank you

1 ACCEPTED SOLUTION
Poojara_D12
Super User
Super User

Hi @Tadadada 

To count patients per month based on the MONTHNUM column, use this DAX formula:

Patient Count = COUNTROWS(FILTER(TableName, TableName[MonthNum] = SELECTEDVALUE(TableName[MonthNum])))

Replace TABLENAME with your actual table name.

This formula counts rows where the MONTHNUM matches the current month context in your visual, giving you a monthly patient count.

 

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

View solution in original post

5 REPLIES 5
Tadadada
New Member

Poojara,
This solution is just what I needed. Thank you

divyed
Super User
Super User

Helo @Tadadada ,

 

You can create a measure for the same.

 

PatientsPerMonth =
CALCULATE(
COUNT('YourTable'[patients]),
ALLEXCEPT('YourTable', 'YourTable'[MonthNum])
)

 

I hope this helps.

 

Mark this as solution if this helps or give a thumbs up. 

 

Cheers.

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/

divyed,

Thank you for your help

Poojara_D12
Super User
Super User

Hi @Tadadada 

To count patients per month based on the MONTHNUM column, use this DAX formula:

Patient Count = COUNTROWS(FILTER(TableName, TableName[MonthNum] = SELECTEDVALUE(TableName[MonthNum])))

Replace TABLENAME with your actual table name.

This formula counts rows where the MONTHNUM matches the current month context in your visual, giving you a monthly patient count.

 

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Poojara
Data Analyst | MSBI Developer | Power BI Consultant
YouTube: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
FreemanZ
Super User
Super User

hi @Tadadada ,

 

just plot a visual with monthnumber column and a measure like:

count = DISTINCTCOUNT(tablename[patient])

 

or?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

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.