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
aanchalsharma18
Regular Visitor

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?

10 REPLIES 10
v-sdhruv
Community Support
Community Support

Hi @aanchalsharma18 ,

Can you please share what error or issue you are getting so that we can help you better?

Thank you

v-sdhruv
Community Support
Community Support

Hi @aanchalsharma18 ,

Sorry to know that the issue was not resolved.
Can you please share what error or issue you are getting so that we can help you better.
Or share a sample data excluding sensitive information
Thank you.

v-sdhruv
Community Support
Community Support

Hi @aanchalsharma18 ,

Just wanted to check if you got a chance to review the suggestion provided and whether that helped you resolve your query?

Thank You

Hi,

Thanks for the suggestion but still I was not able to get the desired reslts.

v-sdhruv
Community Support
Community Support

Hi @aanchalsharma18 ,

Can you try : 

UnengagedDoctorsByTerritory =
CALCULATE(
COUNTROWS(Doctors),
NOT(COUNTROWS(Call) > 0),
TREATAS(
VALUES(Territory_Hierarchy[Name]),
REL_Doctor_Territory[Territory_ID]
)
)

Hope this helps!

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
➤ About: https://sahirmaharaj.com/about.html
➤ 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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

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