Forum Discussion
Isolating context more effectively need help
- 1 year ago
VahidDM actually i think i see what's maybe causing the issue. I've been running under the assumption that when hovering over a specific cell value on the matrix it will be applying a filter on the specific row you are hovering over. But when i click on the specific cell element its highlighting both rows. So i think the matrix visual itself it's allowing me to propagate the context as I am intending.
Can you try this:
To prevent unintended context propagation and ensure your measure only considers relevant filters, you can redefine your measure by explicitly setting the filter context. Here's how:
Export Rail Evaluation =
VAR CurrentSite = SELECTEDVALUE('Site Name'[Site Name])
VAR CurrentHoliday = SELECTEDVALUE('Holiday'[Holiday])
VAR DoesFonterraReq = SELECTEDVALUE('ExportRail'[Does Fonterra req export rail])
RETURN
IF(
NOT(ISBLANK(DoesFonterraReq)),
CALCULATE(
MAX('ExportRail'[Has Coda confirmed export rail]),
FILTER(
ALL('ExportRail'),
'ExportRail'[Site Name] = CurrentSite &&
'ExportRail'[Holiday] = CurrentHoliday &&
'ExportRail'[Does Fonterra req export rail] = DoesFonterraReq
)
),
"No Context"
)
Checks if DoesFonterraReq is not blank to ensure context exists.
Uses CALCULATE with FILTER and ALL('ExportRail') to explicitly apply filters only on the 'ExportRail' table based on the current selections.
This approach isolates the measure from unintended filters from other tables like 'DomesticRail'.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn|Twitter|Blog |YouTube
Hi VahidDM,
Thank you have tried this approach as well. At a surface level it looks like it should work, its explicitly stating the filters we want to apply to the measure and defining the context to the level of granularity we need.
However it doesn't seem to be working still. It's now outputting the correct values for the [DOes Fonterra req export rail] rows (similar to the original measure). But it's still finding context on the [Does Fonterra req domestic rail] rows and showing a value instead of "No Context".
It's odd but my gut feel is somehow this part here, it's somehow pulling a value from the columns of the ExportRail table, when we're looking at columns in the DomesticRail table.
VAR DoesFonterraReq = SELECTEDVALUE('ExportRail'[Does Fonterra req export rail])Is PowerBI assuming some relationship in the background between these two tables?
I've even tried editing the matrix to ONLY have the [Does Fonterra req domestic rail] column from the DomesticRail table, and this export rail evaluation measure still finds context.
- Oliver_Buchanan1 year agoHelper I
For context the relationships are set up as below