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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
aanchalsharma18
New Member

Implementing slicer selection on a table visual where the source tables are having inactive relation

In my dashboard I am having 1 fact table called "Call" and 3 dimension tables namely, Doctors, Territory and Rel_Doctor_Territory in DIRECT QUERY mode.. 

aanchalsharma18_0-1755763821547.png

As per the attached screenshot Doctors and Territory table and joined with Call table using active relationship. The REL_Doctors_Territory table is having common columns of both Doctors(REL_Doctors_Territory.Doctor_ID=Doctors.ID) and Territory(REL_Doctors_Territory.Territory_ID=Territory.ID) table but the REL table is having inactive relationship with Territory table to avoid circular dependency. I want to get data of doctors that have not been engaged and want to filter their data on the basis of Territory's Name. How can I get that done?

5 REPLIES 5
Sahir_Maharaj
Super User
Super User

Hello @aanchalsharma18,

 

Since the REL_Doctors_Territory / Territory link is inactive, you activate it dynamically inside measures. Can you please try this approach:

 

Doctors Not Engaged =
CALCULATE (
    DISTINCTCOUNT ( Doctors[ID] ),
    NOT ( Doctors[ID] IN VALUES ( Call[Doctor_ID] ) ),
    USERELATIONSHIP ( REL_Doctors_Territory[Territory_ID], Territory[ID] )
)

 

Also, if you need the actual list of doctors (not just counts), you can create a calculated table measure:

Unengaged Doctors By Territory =
CALCULATETABLE (
    EXCEPT (
        VALUES ( Doctors[ID] ),
        VALUES ( Call[Doctor_ID] )
    ),
    USERELATIONSHIP ( REL_Doctors_Territory[Territory_ID], Territory[ID] )
)

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,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi Sahir,

Thanks for the help, but I am still not getting the desired results. I missed one point

aanchalsharma18_0-1755778170958.png

The Territory_Hierarchy is source of the Name slicer and it is joined with Territory table. I believe may be that is the reason the solution is not working for me.

Can you please help me with this

 

johnt75
Super User
Super User

Create a measure like

Doctor is not engaged =
VAR CalledDoctors =
    CALCULATETABLE ( DISTINCT ( Call[DoctorID] ), REMOVEFILTERS ( Territory ) )
VAR DoctorsInTerritory =
    CALCULATETABLE (
        VALUES ( Doctors[DoctorID] ),
        USERELATIONSHIP ( Territory[TerritoryID], REL_Doctors_Territory[TerritoryID] )
    )
VAR UnengagedDoctors =
    EXCEPT ( DoctorsInTerritory, CalledDoctors )
VAR Result =
    IF ( SELECTEDVALUE ( Doctors[DoctorID] ) IN UnengagedDoctors, 1 )
RETURN
    Result

Add this as a filter to a table or matrix containing Doctors[DoctorID] and set it to show only when the value is 1.

Thanks for your help but I am still not able to filter the data on the basis of terrirtory name in my report.

Can you share a PBIX with any confidential information removed or anonymised ? You can post a link to e.g. Google Drive, OneDrive etc.

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.