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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
E_hit
Frequent Visitor

countrows based on slicer & related table

Hi,

 

I've got 2 tables

- one with my list of clients

- another with list of apointments related to clients with a date

 

I want to set a date slicer in excel to get the number of apointments per clients at a given date / date range

 

I have created a measure :

Date_selected:=max(tbmkg_apointment[Date_apointment])

 

and a calculated column in my client table but I either go the total number of apointment non related to distinct client with this formula

CALCULATE(
COUNTROWS(tbmkg_apointment);
FILTER (tbmkg_apointment;
tbmkg_apointment[Date_apointment]>= tbmkg_apointment[Date_selected] ) )

or a results taht take into account all apointments for one client even if only one of them is at the desired date:

CALCULATE(
COUNTROWS(RELATEDTABLE(tbmkg_apointment));
FILTER (RELATEDTABLE(tbmkg_apointment);
tbmkg_apointment[Date_apointment]>= tbmkg_apointment[Date_selected] ) )

 

Any insights?

 

Below is a data sample:

table client

code_clientnb_apointmentclient_age
4641231254 123
4641231255 136

 

table apointment

code_apointmentdate_apointmenttype_apointmentcode_client
32323/05/2018A4641231254
56524/05/2018B4641231255

 

I want my calculate field in my client table in nb_apointment

 

Thanks!

 

 

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Hey,

 

I just added my data sample, hope it's clearer!

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors