Forum Discussion
Problem aggregating data at different levels
- 6 years ago
Hi, Anonymous ,
not sure what you are trying to do, but here is a possible strategy for you.
First create separate tables for Table[Var1] and Table[Var2], one table for each. Use these two tables for slicers. Then create measures like this:error_x_agg = IF ( ISFILTERED ( Table_Var1[var1] ); CALCULATE ( SUM ( 'Table'[n_events] ); FILTER ( ALLEXCEPT ( 'Table'; 'Table'[error_x] ); NOT ( 'Table'[var1] IN VALUES ( Table_Var1[var1] ) ) ) ); CALCULATE ( SUM ( 'Table'[n_events] ); ALLEXCEPT ( 'Table'; 'Table'[error_x] ) ) )This example only considers var1, you will have to see how you want to handle situations like: filter on Var1 and not Var2 vs filter on Var2 and not on Var1
Cheers,
Sturla
Hi, Anonymous ,
not sure what you are trying to do, but here is a possible strategy for you.
First create separate tables for Table[Var1] and Table[Var2], one table for each. Use these two tables for slicers. Then create measures like this:
error_x_agg =
IF (
ISFILTERED ( Table_Var1[var1] );
CALCULATE (
SUM ( 'Table'[n_events] );
FILTER (
ALLEXCEPT ( 'Table'; 'Table'[error_x] );
NOT ( 'Table'[var1] IN VALUES ( Table_Var1[var1] ) )
)
);
CALCULATE ( SUM ( 'Table'[n_events] ); ALLEXCEPT ( 'Table'; 'Table'[error_x] ) )
)
This example only considers var1, you will have to see how you want to handle situations like: filter on Var1 and not Var2 vs filter on Var2 and not on Var1
Cheers,
Sturla