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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Cipriano
Helper II
Helper II

Query based on tables without relations?

Hello everyone!

 

I have 3 tables that are not related, and I need to get a combined query, I tried to use UNION and SELECTCOLUMNS, but it was not possible.

 

first table

 

fechaid_productid_facilityconsumoprograma

01-ene-22AX105
02-ene-22AX2015
03-ene-22AY3010
04-ene-22BY4020
05-ene-22BZ5030

 

second table

fechaid_productid_facilityexistenciarecibido

01-ene-22AX10024
02-ene-22AX20056
03-ene-22AY30076
04-ene-22BY40045
05-ene-22BZ50056

 

third table

fechaid_facilityvolumen

01-ene-22X56
02-ene-22X43
03-ene-22Y45
04-ene-22Y65
05-ene-22Z21

 

expected result

 

fechaid_productid_facilityconsumoprogramaexistenciarecibidovolumen

01-ene-22AX1051002456
02-ene-22AX20152005643
03-ene-22AY30103007645
04-ene-22BY40204004565
05-ene-22BZ50305005621

 

any ideas, Thank you very much in advance.

 

PBIX-file: Query 

 

1 ACCEPTED SOLUTION
v-xiaosun-msft
Community Support
Community Support

Hi @Cipriano ,

 

You can use "Merge Queries as new" in Power Query and the expand the columns you need.

vxiaosunmsft_0-1669357693644.pngvxiaosunmsft_1-1669357734458.png

Final output:

vxiaosunmsft_2-1669357770495.png

Or you can try what @FreemanZ  suggested to use TREATAS function which is best for use when a relationship does not exist between the tables.

 

You can reference the following document.

Merge queries overview - Power Query | Microsoft Learn

Virtual Relationship with TREATAS - Microsoft Power BI Community

 

Best Regards,
Community Support Team _ xiaosun

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

2 REPLIES 2
v-xiaosun-msft
Community Support
Community Support

Hi @Cipriano ,

 

You can use "Merge Queries as new" in Power Query and the expand the columns you need.

vxiaosunmsft_0-1669357693644.pngvxiaosunmsft_1-1669357734458.png

Final output:

vxiaosunmsft_2-1669357770495.png

Or you can try what @FreemanZ  suggested to use TREATAS function which is best for use when a relationship does not exist between the tables.

 

You can reference the following document.

Merge queries overview - Power Query | Microsoft Learn

Virtual Relationship with TREATAS - Microsoft Power BI Community

 

Best Regards,
Community Support Team _ xiaosun

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

FreemanZ
Super User
Super User

you can treat unrelated table columns as related ones with TREATAS function. https://dax.guide/treatas/

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors