Forum Discussion
Search then pull column data into another table
- 1 year ago
Hello Earl40,
Thank you for reaching out to the Microsoft Fabric Community Forum.I have reproduced your scenario in Power BI Desktop based on the details you shared and I got the expected result as per your requirements.
You wanted to bring in Order Date and Source from Table B into Table A, only if:
- ID #, Category, and Create Date match between both tables
- AND the Category is either A or B
What I Did Practically in Power BI:
- Filtered Table A to include only Category A and B
- Performed a Merge (Inner Join) between Table A and Table B using three matching fields: ID #, Category, and Create Date
- Expanded the required columns (Order Date and Source) from Table B into Table A
Expected Output:
For your reference, I’ve attached the .pbix file that demonstrates the solution using your sample data. Please feel free to download and explore it to apply the same logic in your model.Best Regards,
Ganesh Singamshetty. - 1 year ago
Hi,
Try this measure
=if(TableA[Category]="A"||TableA[Category]="B",CALCULATE(MAX(TableB[Order Date]),FILTER(TableB,TableB[Category]=EARLIER(TableA[Category])&&TableB[ID]=EARLIER(TableA[ID]))),BLANK())
Hi,
Write this calculated column formula in TableA
=if(TableA[Category]="A"||TableA[Category]="B",CALCULATE(MAX(TableB[Order Date]),FILTER(TableB,TableB[Category]=EARLIER(TableA[Category])&&TableB[Create Date]=EARLIER(TableA[Create Date]))),BLANK())
Hope this helps.
Ashish_Mathur Thank you. I tried the formula and all values came out blank. it turns out I have a data mismatch in the date columns that wont be resolved. If I want to alter the formula to just want to match the Category and ID numbers, how would that be done? thank you in advance
- Irwan1 year agoSuper User
Jihwan_Kim 's solution will do the magic if you want to get matched value of category and ID between two table.
Thank you.
- Ashish_Mathur1 year agoSuper User
Hi,
Try this measure
=if(TableA[Category]="A"||TableA[Category]="B",CALCULATE(MAX(TableB[Order Date]),FILTER(TableB,TableB[Category]=EARLIER(TableA[Category])&&TableB[ID]=EARLIER(TableA[ID]))),BLANK())