Forum Discussion
Anonymous
6 years agoNot applicable
If specific values are selected, return specific result
Hi all, I have a column "Customer", which contains customer name from A to F. What I need to do is if customer A, B, and C are selected by slicer, return X; if customer C and E are selected,...
- 6 years ago
Anonymous
thx for great explanation
i have rewritten my measure
Measure3 = SWITCH(TRUE(), COUNTROWS(FILTER('Customer_lookup','Customer_lookup'[Customer Name]="A" || 'Customer_lookup'[Customer Name]="B" || 'Customer_lookup'[Customer Name]="C"))=3 && COUNTROWS('Customer_lookup')=3,CALCULATE(SUM(Sale_data[Sale])), COUNTROWS(FILTER('Customer_lookup','Customer_lookup'[Customer Name]="C" || 'Customer_lookup'[Customer Name]="E"))=2 && COUNTROWS('Customer_lookup')=2,CALCULATE(SUM(Sale_data[Sale])), BLANK() )but then again Im sure this is not the best and beautiest solution
and make sure you have relationships between your tables by [Customer_Name] -> [Customer] fields
az38
Community Champion
6 years agoAnonymous
thx for great explanation
i have rewritten my measure
Measure3 =
SWITCH(TRUE(),
COUNTROWS(FILTER('Customer_lookup','Customer_lookup'[Customer Name]="A" || 'Customer_lookup'[Customer Name]="B" || 'Customer_lookup'[Customer Name]="C"))=3 && COUNTROWS('Customer_lookup')=3,CALCULATE(SUM(Sale_data[Sale])),
COUNTROWS(FILTER('Customer_lookup','Customer_lookup'[Customer Name]="C" || 'Customer_lookup'[Customer Name]="E"))=2 && COUNTROWS('Customer_lookup')=2,CALCULATE(SUM(Sale_data[Sale])),
BLANK()
)
but then again Im sure this is not the best and beautiest solution
and make sure you have relationships between your tables by [Customer_Name] -> [Customer] fields
Anonymous
6 years agoNot applicable
Hi az38, thanks a lot for your help, it worked!