Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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,...
  • az38's avatar
    az38
    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