Forum Discussion

lcasey's avatar
lcasey
Post Prodigy
9 years ago
Solved

Need assistance with LookupValues

Hello,   I have two tables, each tble contains country and amount.   How can I use the LookupValue function in Power BI to return the balanc of the country from anoyther table?  
  • Vvelarde's avatar
    Vvelarde
    9 years ago

    lcasey

     

    Another Way using your tables sample:

     

    ValuesFromTable2 =
    IF (
        HASONEVALUE ( Table1[Country] ),
        AVERAGEX (
            SUMMARIZE (
                Table2,
                Table2[Country],
                "Values", CALCULATE (
                    SUM ( Table2[Values] ),
                    FILTER ( Table2, Table2[Country] = VALUES ( Table1[Country] ) )
                )
            ),
            [Values]
        ),
        CALCULATE ( SUM ( Table2[Values] ) )
    )