Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Lookup a third table to return a value

I have three tables as shown below. All three are unrelated and i dont want to move region name to country table.

I am looking for a calculated table as shown in output. 

 

Anonymoous11_2-1698862156361.png

Is this possible? Any help on this is much appreciated. thanks in advance.

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

Please try code as below to create a measure.

SUMX = 
VAR _Summarize =
    SUMMARIZE (
        DimRegion,
        DimRegion[Region Name],
        "Amount",
            VAR _Country =
                CALCULATETABLE (
                    VALUES ( DimCountry[Country] ),
                    FILTER ( DimCountry, DimCountry[Region] = MAX ( DimRegion[Region] ) )
                )
            RETURN
                CALCULATE (
                    SUM ( Country[Amount] ),
                    FILTER ( Country, Country[Country] IN _Country )
                )
    )
RETURN
    SUMX ( _Summarize, [Amount] )

Data model:

vrzhoumsft_0-1699002414492.png

Result is as below.

vrzhoumsft_1-1699002437653.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

@lbendlin , @v-rzhou-msft Could you please help on this

Hi @Anonymous ,

 

Please try code as below to create a measure.

SUMX = 
VAR _Summarize =
    SUMMARIZE (
        DimRegion,
        DimRegion[Region Name],
        "Amount",
            VAR _Country =
                CALCULATETABLE (
                    VALUES ( DimCountry[Country] ),
                    FILTER ( DimCountry, DimCountry[Region] = MAX ( DimRegion[Region] ) )
                )
            RETURN
                CALCULATE (
                    SUM ( Country[Amount] ),
                    FILTER ( Country, Country[Country] IN _Country )
                )
    )
RETURN
    SUMX ( _Summarize, [Amount] )

Data model:

vrzhoumsft_0-1699002414492.png

Result is as below.

vrzhoumsft_1-1699002437653.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

@v-rzhou-msft  Thank you very much for your solution. it works without any error.

V_20
Frequent Visitor

@amitchandak could you please help on this

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors