Forum Discussion
Custom Aggregation in a Matrix by Using another query?
- 2 years ago
output
Measure = SWITCH( TRUE(), ISINSCOPE(DP_Level[discoveryprodcategory_id]),SUM(DP_Level[online_Customers]), ISINSCOPE(DC_Level[discoverydept_num]),SUM(DC_Level[online_Customers]) )just need to reverse the order of the levels .
when using isinscope, you should always start with the lowest level ,and go up .
hope this helps .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
hello alaynanich
since you are using a matrix, you can take advantage of the isinscope function to control the calculation per each level.
so you can create a measure following the below pattern :
measure =
switch(
true() ,
isinscope( tbl_name[col_name]) , calculation ,
insinscope(tbl_name[col_name_1]) , calculation_1 ,
....
)
let me know if that works for you .
If this answers your question , mark it as the solution ✅ so can you can help other people in the community find it easily .
- alaynanich2 years agoHelper I
Thank you for the reply Daniel29195 , I tried the isinscope method and it worked for the high level D1, but not for the subgroups. I attached a sample file sample for any insight - I think it may be because i'm using another "sku" table to connect the primary keys? Should I rework my model first?
https://drive.google.com/file/d/15pCLA4aNKvYoY0eC1dCN8aQSEBUAh9gn/view?usp=sharing- Daniel291952 years agoCommunity Champion
output
Measure = SWITCH( TRUE(), ISINSCOPE(DP_Level[discoveryprodcategory_id]),SUM(DP_Level[online_Customers]), ISINSCOPE(DC_Level[discoverydept_num]),SUM(DC_Level[online_Customers]) )just need to reverse the order of the levels .
when using isinscope, you should always start with the lowest level ,and go up .
hope this helps .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠- alaynanich2 years agoHelper I
Daniel29195 Thanks you so much!!! This will be so helpful in the future - excited to learn a new function