Forum Discussion

ctmullins's avatar
ctmullins
Icon for Advocate II rankAdvocate II
4 years ago
Solved

USERELATIONSHIP() applied to entire report?

Hi guys!  Relative newbie here, been working with PBI for the last six months or so, previously coming from a Qlik background.

 

I have a problem that I'm stumped trying to resolve.  I've scoured the various forums and blogs looking for a possible answer, but haven't found anything yet.

 

I have a star-schema data model with a date table that has two possible relationships to my fact table.  One relationship is marked as active, and the other inactive.

 

I've learned how to use USERELATIONSHIP() in my measures to show aggregated scalar values correctly.  But my issue is that there doesn't appear to be any way to deploy USERELATIONSHIP() to globally apply to all visuals throughout the entire report.  Essentially, I want one toggle button/filter to trigger a global USERELATIONSHIP() at the data model level, with the entire report updating appropriately.

 

 

Right now my toggle is built as a filter, but I'm not married to that if there's a better way (button? slicer?).

 

 

And here's what my (correctly functioning) Measures look like:

 

Quantity A = CALCULATE(Sum('Revenue Fact'[TotalQuantityNBR]), USERELATIONSHIP('Revenue Fact'[ActivityDateNBR],'Calendar'[DateNBR]))
 
Quantity S = CALCULATE(Sum('Revenue Fact'[TotalQuantityNBR]), USERELATIONSHIP('Revenue Fact'[ServiceDateNBR],'Calendar'[DateNBR]))
 
Total Charge Quantity = SWITCH(SELECTEDVALUE('_Date Toggle'[Code])
, "A", [Quantity A], "S", [Quantity S])
 
But this approach does not work when showing the row-level detail in a Table visual (for instance).
 
I simply cannot figure out how to globally enable the alternate relationship when the user requests it.
 
Anybody else tried to solve this?  Is there a way to request this as future functionality?
 
Thanks!
  • SpartaBI's avatar
    SpartaBI
    4 years ago

    well, you have a lot of measures that return specific values, in case there is only 1 possible scalar value, for example: SELECTEDVALUE(). Whatever tooltip you are using, if it direct to a visual in Power BI that you have put there implicit measures, you can replace them with explicit measures, and than the userelationship will kick in  🙂
    You can't do that without a measure, you can't change globally the active relatioship. It's only per measure or group of measures with use of calculation groups

4 Replies