cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lfrigione
Helper II
Helper II

PowerBI relations

Hi,
I have three tables:
Facility(FacilityId, FacilityName, ...)
AgeRange(AgeRangeId, minAge, maxAge, FacilityId, ...)
ClientPeriod(ClientId, From, To, AgerangeId, FacilityId, ...)

I have two active relations between Facility-AgeRange and Facility-ClientPeriod that allows me to filter visible contents for the logghed user (one user can see only data of a specific facility).

Then I have created a third relation between Agerange-ClientPeriod.

I have that simple measure 
Test = CALCULATE(COUNTROWS(ClientPeriod), USERELATIONSHIP(ClientPeriod[AgeRangeId], AgeRange[AgeRangeId]))
that I wont to plot in a table that shows me how many period I have for each AgeRange.

When I try to do that I recive this error: 
Join paths are expected to form a tree, but the table 'ClientPeriod' has two join paths to table 'Facility': 'ClientPeriod'->'AgeRange'->'Facility' and 'ClientPeriod'->'Facility'.

Very important: I filter Facility Table with RLS, If I do not use RLS it works.

 

How can I solve that problem?
Thank you.

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @lfrigione,

It seems like userelationship and RLS conflicts with the real and virtual relationship mappings.
Have you try to removing the virtual relationship and manually using the DAX expression to apply a filter in your calculations?

 

Test =
VAR inativeFilter =
    VALUES ( AgeRange[AgeRangeId] )
RETURN
    CALCULATE (
        COUNTROWS ( ClientPeriod ),
        FILTER ( ALLSELECTED ( ClientPeriod ), [AgeRangeId] IN inativeFilter )
    )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

4 REPLIES 4
v-shex-msft
Community Support
Community Support

HI @lfrigione,

It seems like userelationship and RLS conflicts with the real and virtual relationship mappings.
Have you try to removing the virtual relationship and manually using the DAX expression to apply a filter in your calculations?

 

Test =
VAR inativeFilter =
    VALUES ( AgeRange[AgeRangeId] )
RETURN
    CALCULATE (
        COUNTROWS ( ClientPeriod ),
        FILTER ( ALLSELECTED ( ClientPeriod ), [AgeRangeId] IN inativeFilter )
    )

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

Thank you @v-shex-msft 

amitchandak
Super User
Super User

@lfrigione , Facility should not join with AgeRange, it should only join with ClientPeriod,

 

if need have one inactive join when needed

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! !!
Dashboard of My Blogs !! Connect on Linkedin
Want To Learn Power BI
Learn Power BI Beginners !! Advance Power BI Concepts !! Power BI For Tableau User !! Learn Power BI in Hindi !!
Proud to be a Super User!

Hi @amitchandak ,

thank you for replying.

I need this relation because evey Facility has it's own age ranges.

When one account log in I would like to use RLS to filter this content.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors