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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
manojgour
Microsoft Employee
Microsoft Employee

How to count number of rows for entries which are not related?

 

I am looking to count rows from table  name - 'Appointment' which was 'Cancelled' on a given Slot. Once appointment is cancelled that entry is deleted from table - 'Slot'

 

Relationship between two tables:

Appointment[PK-appointmentId, FK-slotId] -> Slot[PK-slotId]

 

Active relationship shown in below screenshot-

 

manojgour_0-1623440726060.png

 

 

Below screenshot is the detail from table when an appointment is 'Cancelled' and how msemr_primaryslot(FK) in Appointment table is null
 

manojgour_1-1623440726062.png

 

 

Report has a 'Date Slicer' using Slot[Slot date] and when we choose date from slicer, measure wouldn't be able to navigate to count rows with Cancelled Status from Appointment[table]

 

I tried using function USERELATIONSHIP with inactive relationship on 'Appointment'[Appointment date] -> 'Slot'[Slot Date] but it would return empty.

 

PS - I have to use Slot [Slot date] for date slicer for other visuals and measurements to work.

 

Any help or suggestions?

1 ACCEPTED SOLUTION
manojgour
Microsoft Employee
Microsoft Employee

Thanks for your reply @Anonymous 

I was able to resolve this problem with changes in Data modeling and using USERELATIONSHIP dax function.
This time I changed relationship to inactive between Slot and Appointment tables whereas now both the tables relationship with Calendar table was made active to achieve other measures to work in report as usual.
Cancelled count calculation measure started to drive from Slot[date]->Calendar[date]->Appointment[date] route and my other matrix calculation for other appointment status made use of dax function -

USERELATIONSHIP('Appointment'[FK_slotid], Slot[PK_slotid]) )

 
 

manojgour_0-1623694095872.png

 

 

View solution in original post

2 REPLIES 2
manojgour
Microsoft Employee
Microsoft Employee

Thanks for your reply @Anonymous 

I was able to resolve this problem with changes in Data modeling and using USERELATIONSHIP dax function.
This time I changed relationship to inactive between Slot and Appointment tables whereas now both the tables relationship with Calendar table was made active to achieve other measures to work in report as usual.
Cancelled count calculation measure started to drive from Slot[date]->Calendar[date]->Appointment[date] route and my other matrix calculation for other appointment status made use of dax function -

USERELATIONSHIP('Appointment'[FK_slotid], Slot[PK_slotid]) )

 
 

manojgour_0-1623694095872.png

 

 

Anonymous
Not applicable

Hi @manojgour ,

Could you please validate that is there any record exist in table Slot when appointment is 'Cancelled', same slotid with the one in table Appointment and 'Appointment'[Appointment date] equal 'Slot'[Slot Date]? Besides that, please check whether the data type of 'Appointment'[Appointment date] and 'Slot'[Slot Date] are same or not? Could you please provide some sample data(exclude sensitive data) in order to make troubleshooting? It is better if you can provide your sample pbix file(please clear sensitive data). Thank you.

On the other hand, please review the content in the following links. Hope they can help you resolve the problem.

Cannot create multiples column relationship between two tables

Use Multiple Connections Between Tables

Best Regards

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.