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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Duplicating index and match on Power Bi from excel

Hi 

I have an equation on excel to return a value based on two criterea. I am using an index and match equation on excel that I would like to duplicate onto Power Bi. 

 

shaheemaF_0-1626337035690.png

 

In power Bi these two tables will be in different sheets. not sure if that would be an issue 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

If you use import mode to connect database, you can merge two tables by matching the name and No. columns in Power Query Editor.

 

vkkfmsft_0-1627288758431.png

vkkfmsft_1-1627288786783.png

vkkfmsft_2-1627288800944.png

 

And if you use direct query mode to connect database, you can try the following calculate table:

 

Table 2 = 
ADDCOLUMNS(
    'Table (2)',
    "x2", CALCULATE( SUM(Sheet1[x2]), FILTER( Sheet1, Sheet1[Name] = EARLIER([name]) && Sheet1[No.] = EARLIER([No.]) ) ),
    "x", CALCULATE( SUM(Sheet1[x]), FILTER( Sheet1, Sheet1[Name] = EARLIER([name]) && Sheet1[No.] = EARLIER([No.]) ) ),
    "c", CALCULATE( SUM(Sheet1[c]), FILTER( Sheet1, Sheet1[Name] = EARLIER([name]) && Sheet1[No.] = EARLIER([No.]) ) )
)

vkkfmsft_3-1627290729008.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

If you save these two tables in the same sheet, when you use PowerBI to connect to the excel, we find that you can store them in two tables.

 

vkkfmsft_0-1626659631425.pngvkkfmsft_1-1626659643583.pngvkkfmsft_2-1626659659492.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

 

Anonymous
Not applicable

Hi Winniz

 

Thank you for your response. Unfortunately this is not what I was looking for. I belive I was not clear sorry about that.

I currently have a database in power Bi directly linked to a querry ( columns J&K on previous screenshot), I also have another excel file that's linked to power Bi (colums A to F in previous screenshot). 

I want to perform a calculation on Power Bi to get column M on the screenshot. On excel the following formula can be used:
=INDEX(D:D, MATCH(1,(A:A=J3)*(B:B=L3),0))

 

I would like to translate this in Power Bi.  Thank you!

Hi @Anonymous ,

 

If you use import mode to connect database, you can merge two tables by matching the name and No. columns in Power Query Editor.

 

vkkfmsft_0-1627288758431.png

vkkfmsft_1-1627288786783.png

vkkfmsft_2-1627288800944.png

 

And if you use direct query mode to connect database, you can try the following calculate table:

 

Table 2 = 
ADDCOLUMNS(
    'Table (2)',
    "x2", CALCULATE( SUM(Sheet1[x2]), FILTER( Sheet1, Sheet1[Name] = EARLIER([name]) && Sheet1[No.] = EARLIER([No.]) ) ),
    "x", CALCULATE( SUM(Sheet1[x]), FILTER( Sheet1, Sheet1[Name] = EARLIER([name]) && Sheet1[No.] = EARLIER([No.]) ) ),
    "c", CALCULATE( SUM(Sheet1[c]), FILTER( Sheet1, Sheet1[Name] = EARLIER([name]) && Sheet1[No.] = EARLIER([No.]) ) )
)

vkkfmsft_3-1627290729008.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Anonymous
Not applicable

Hi Winniz

 

Thank you so much. This works!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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