Forum Discussion
obungianer
2 years agoNew Member
Calculate sum using different relationships based on condition
Hello everyone, I'm trying to build a rather complicated DAX measure but I have no luck getting the expected the result. Here's a simplified description of my data: I have a table that contains ...
Anonymous
2 years agoNot applicable
Hi obungianer
I don't quite understand the logic of the "is_switched" column, here's the test I'm doing so far, maybe you can try it:
Create two measures as follow
is_switched = SWITCH(TRUE(),
MAX([company_id]) = 1 && MAX([account_schema_id1]) = 1, 1,
MAX([company_id]) = 1 && MAX([account_schema_id1]) = 2, 0,
MAX([company_id]) = 2 && MAX([account_schema_id1]) = 5, 1,
MAX([company_id]) = 2 && MAX([account_schema_id1]) = 6, 1)
sum of amount1 = CALCULATE(SUM(Booking[amount]), FILTER(Booking, [is_switched] = 1), USERELATIONSHIP(Booking[account_schema_id2], 'Account schema'[account_schema_id]))
The result for company 1:
Best Regards,
Yulia Xu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.