Hello,
I'm trying to wrap my brain around the way DAX filters are interacting in a many-to-many expression I'm developing.
'Mapping' tables are essentially bridge tables. The measures will only be modified in ways that aren't relevant to this discussion (removing some date relationship stuff not worth explaining here).
Here is the working measure, based on some brilliant BI devs' work regarding a many-to-many revolution.
Total A:=CALCULATE(
CALCULATE(
SUM(Fact[Value])
,SUMMARIZE(Mapping1,Fact[Id])
)
,SUMMARIZE(Mapping2,Fact[Id])
)
This follows the structure of cascading many-to-many, but they relationships do not actually ascade, as suggested by SUMMARZE() being identical in both.
That's all well and good, no issues. What I'm trying to do now is to switch entirely to a flattened mapping table (bridge table). I've already created the flattened many-to-many structure, but haven't been able to remove the various mapping tables, since some measures still rely on them.
Basically what I'm doing with "Total" calculations like the above is getting totals for calculating a percentage that is independent of the primary taxonomy (which is what users will be looking at primarily, with the others used as filters), but filters based on selections of 'App' and 'Version' as shown here. I'd like to be able to do this without referring to the individual bridge tables, which I'd like to delete altogether.
I've been successful in replicating the same results using the flattened bridge table, but *only* for a single filter table (Filter1 maps to Mapping0 on the opposite 'side' of Fact in this case, as opposed to the Mapping1/2 above):
Total B:=CALCULATE(
SUM(Fact[Value])
,SUMMARIZE(
CALCULATETABLE(
Mapping0
,ALLEXCEPT(Mapping0,Filter1)
)
,Fact[Id]
)
)
This helps me with some measures, but not all. If I emulate the structure of Total A and add a nested CALCULATE with SUMMARIZE, the result is not as expected--only the inner ALLEXCEPT will work, and the outer one is ignored.
I tried using KEEPFILTERS on the inner ALLEXCEPT, but this sliced everything out and gave a blank row every time.
I also tried to use a second ALLEXCEPT in the same CALCULATETABLE, but this also failed (it was the same result I'd get using ALL).
I was excited that I got the CALCULATETABLE part working in 5 minutes this morning, disappointing that I couldn't add a second filter on it despite trying so long! Any pointers? Happy to answer further questions.
Thanks,
-Bryan