C. Rush
C. Rush

Reputation: 62

ALL() isn't working to "remove a filter" in DAX; relationship issue?

Basic premise:

What I need:

What's working:

My issue:

I have tried to remove this filter by tacking on ALL(Zones[Zone]) and/or ALL('Order Details'[Zone]), but it doesn't help, presumably because it is reporting "all zones" actually found in the 'Credits' table. I'm hoping there's some way to ask it to report all zones in the 'Order Details' table based upon SOs in the 'Credits' table.

In case it helps, here's how the relationships are structured; as an aside, I've tried mixing and matching various combinations of active/inactive, single vs. bidirectional filtering, etc., but the current configuration is the only one that seems to remotely work as desired. Relationships in data model

I'm grateful for any suggestions; please let me know if anything is unclear. Thank you.

Upvotes: 2

Views: 3302

Answers (1)

Alexis Olson
Alexis Olson

Reputation: 40204

I was able to get it to work by using 'Order Details'[Zone] rather than Zones[Zone] in the table visual and this measure:

Order $ by Zone = 
CALCULATE (
  SUM ( 'Order Details'[DOL_AMT] ),
  USERELATIONSHIP ( 'Order Details'[SO], Credits[SO] )
)

Notice that regardless of your measure, there is no row in Credits corresponding to zone C, so it doesn't know what to put in the CREDIT column unless you tell it exactly how.

If you remove the CREDIT dimension column, then you don't need to swap tables as I suggested above. You can just use the measure above and then write a new measure for the CREDIT column instead:

CreditValue =
CALCULATE(
    VALUES(Credits[CREDIT]),
    ALL(Credits),
    Credits[SO] IN VALUES('Order Details'[SO])
)

Upvotes: 1

Related Questions