cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GuidoPinares
Frequent Visitor

Active and Inactive Relationships help!

Hi Community,

 

Thanks for any help!

 

I have the following data schema:

 

GuidoPinares_1-1664750587782.png

 

I would like as a result All Prescribers that doesnt exists in "OActivities" and "Activities" Tables, but they exists in "Sales" Table. By now I solved it as following:

 

Measures: 

OActivity DropIn = CALCULATE(COUNT(OActivities[OActivityID]),USERELATIONSHIP(OActivities[PrescriberID],Prescribers[PrescriberID]))
 
Activity Filter
CALCULATE(COUNT(Activities[ActivityID]),USERELATIONSHIP(Activities[PrescriberID],Prescribers[PrescriberID]))
 
QuantityDispensed
SUM(Sales[quantitydispensed])
 
and then I used the filters to check if "quantityDispensed" is greater than 0 (this means that they exists in Sales Table), and If Activities are blank (this means that they doesnt exists in neither OActivities nor Activities Tables)
 
GuidoPinares_2-1664750978723.png

 

Its working by now, but it is too slow (even with 5000 test prescribers). Also, when I increase the prescribers to more than 10,000 the visual breaks and show me the "Insufficient memory error".

 

I was thinking of maybe would be better to add a Boolean custom column that will do this check and return a true or false, then i can filter this column to show only the True ones (The ones that fits with the criteria), but im not sure how to do this.

 

Any other recommendation will be very welcome!

 

Thanks in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@GuidoPinares , Prescribers is a dimension, it should not join with another dimension employee. Also avoid Bi-Directional join

 

In case you want just to filter the slicer based on employee refer

How to filter the slicer of a disconnected table: https://youtu.be/cV5WfaQt6C8

View solution in original post

2 REPLIES 2
yingyinr
Community Support
Community Support

Hi @GuidoPinares ,

You can create a measure [Flag] as below and apply a visual-level filter with the codition ([Flag] is 1😞

Flag =
VAR _selpres =
    SELECTEDVALUE ( Prescribers[PrescriberID] )
VAR _oactabs =
    UNION (
        VALUES ( OActivities[PrescriberID] ),
        VALUES ( Activities[PrescriberID] )
    )
VAR _selestab =
    VALUES ( Sales[PrescriberID] )
RETURN
    IF ( NOT ( _selpres ) IN _oactabs && _selpres IN _selestab, 1, 0 )

 

If the above one can't help you get the desired result, please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@GuidoPinares , Prescribers is a dimension, it should not join with another dimension employee. Also avoid Bi-Directional join

 

In case you want just to filter the slicer based on employee refer

How to filter the slicer of a disconnected table: https://youtu.be/cV5WfaQt6C8

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.