Forum Discussion
IF statement combined with multiple Lookupvalues from a different Table
- 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 )Best Regards,
Dale
Thanks a lot Dale!
Works like a charm.
Kind regards,
Igor
Hi,
I think this is similar as it involves an IF statement that references more than 1 table.
So, in this basic example I have 2 tables and want to say something like:
IF( Table1[ColumnA] = "XXX" && Table2[ColumnB] = "YYY", "Result A", "Result B")
In my real example both Table 1 and Table 2 have a direct relationship with a master table, so an indirect relationship with each other. I have also tried a simplified version with the same data, just these 2 tables with a many to many relationship to see if that made it any easier but it hasn't!
I am not sure if you do this another way in Power BI as I can't seem to find an easy solution anywhere?
Any help appreciated! Thanks!