cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
molegris
Advocate III
Advocate III

Why do I always have to add CROSSFILTER + NONE when I use USERELATIONSHIP ?

Hi,

 

When I read documentation, blogs and forums, it seems like USERALATIONSHIP can be used alone.  It seems so simple yet I cannot get it to work without having to add a CROSSFILTER to disable the default active relationship.

 

Here's my usecase :

Basically I get it to work in the T3 test by explicitly disabling the default relationship using CROSSFILTER + NONE. 

But I don't understand why the T2 option does not work.

 

molegris_0-1637690813696.png

Default active relationship is Programme[Code] = RelanceProgramme[Programme]

The inactive relationship is Programme[DecReference] = RelanceProgramme[Programme]

 

Here's the row from the Programme dimension.

Record from the dimension table ProgrammeRecord from the dimension table Programme

 

DEFINE
    // BASELINE using the default active relationship
    VAR _t1 =
        CALCULATETABLE ( RelanceProgramme, Programme[Code] = "NWE.0F" )
        
    // Attempt #1 to activate the second relationship  (FAIL)
    VAR _t2 =
        CALCULATETABLE (
            RelanceProgramme,
            USERELATIONSHIP ( Programme[DecReference], RelanceProgramme[Programme] ),
            Programme[Code] = "NWE.0F"
        )
        
    // Attempt #2 to acticate the second relationship (SUCCESS)
    VAR _t3 =
        CALCULATETABLE (
            RelanceProgramme,
            USERELATIONSHIP ( Programme[DecReference], RelanceProgramme[Programme] ),
            CROSSFILTER ( Programme[Code], RelanceProgramme[Programme], NONE ),
            Programme[Code] = "NWE.0F"
        )

 

 

 

T1 - Using the default active relationship (BASELINE)T1 - Using the default active relationship (BASELINE)

T2 - Trying to activate the second relationship with USERELATIONSHIP.  But I get same results as T1.  Why is this not working ??T2 - Trying to activate the second relationship with USERELATIONSHIP. But I get same results as T1. Why is this not working ??

 

T3 - Activating the second relationship AND explicitly disabling the default one using CROSSFILTER + NONE.   (That works fine!)T3 - Activating the second relationship AND explicitly disabling the default one using CROSSFILTER + NONE. (That works fine!)

 

 Thanks

--mo

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

I'd love for someone like @marcorusso to give a more definitive answer but here's my guess for what's happening.

 

Typically, when you have multiple relationships like this, it's usually one column from a dimension table relating to two separate columns in a fact table, for example, dimDate[Date] 1-->* fact[Ship Date] and dimDate[Date] 1-->* fact[Delivery Date]). In your case, you have two different columns on a dimension table filtering the same column on the many-side of the relationship. USERELATIONSHIP will override an active relationship from the same column on the 1-side but it doesn't appear to deactivate additional relationships to the same column on the many-side, just like it would not deactivate relationships from other tables to that column.

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

I'd love for someone like @marcorusso to give a more definitive answer but here's my guess for what's happening.

 

Typically, when you have multiple relationships like this, it's usually one column from a dimension table relating to two separate columns in a fact table, for example, dimDate[Date] 1-->* fact[Ship Date] and dimDate[Date] 1-->* fact[Delivery Date]). In your case, you have two different columns on a dimension table filtering the same column on the many-side of the relationship. USERELATIONSHIP will override an active relationship from the same column on the 1-side but it doesn't appear to deactivate additional relationships to the same column on the many-side, just like it would not deactivate relationships from other tables to that column.

Thank you for pointing out this subtile but important distinction.  Make sense! 🙂

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors