Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

IF statement combined with multiple Lookupvalues from a different Table

I try to find my answer online, but after a day without success I hope that maybe one of you can help me with my issue.   What I try to do is: if a field has a value that can be found in that other...
  • v-jiascu-msft's avatar
    v-jiascu-msft
    8 years ago

    Hi Igor,

     

    Add these two calculated columns please. Then calculating the % would be easy.

    AppleCheck =
    VAR appleSizes =
        CALCULATETABLE ( VALUES ( FruitTable[Size] ), 'FruitTable'[Type] = "Apple" )
    RETURN
        IF ( [AppleSize] IN appleSizes, "Yes", "No" )
    BananaCheck =
    VAR BananaSizes =
        CALCULATETABLE ( VALUES ( FruitTable[Size] ), 'FruitTable'[Type] = "Banana" )
    RETURN
        IF ( [BananaSize] IN BananaSizes, "Yes", "No" )
    % =
    DIVIDE (
        CALCULATE ( COUNT ( MainTable[AppleCheck] ), MainTable[AppleCheck] = "Yes" ),
        COUNT ( MainTable[AppleCheck] ),
        0
    )

    IF_statement_combined_with_multiple_Lookupvalues_from_a_different_Table

     

    Best Regards,

    Dale