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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
jockycamposeco
New Member

Creating one table from two, one of them with no flat data

Hi there community, may you can help me please, i'm struggling trying to create a new table based on other two, the thing is that in one table we have the main user info and the other has custom form fields so ther only field_id and Value.

 

User:

ID
Name

Surname

User_data:

id

form_field_id

user_id

value

Form_field:

id

field_name (phone, address, colour, etc)

 

 

Im trying to aim something like this

 

FullUserData

ID
Name

Surname

Phone

Address

Colour

...

 

 

In a Mysql query it could be something like:


SELECT id, name, surname,
(SELECT value FROM user_data where user_data.user_id = users.id and form_field_id = 3805) as Phone,
(SELECT value FROM user_data where user_data.user_id = users.id and form_field_id = 3809) as Address,
(SELECT value FROM user_data where user_data.user_id = users.id and form_field_id = 3881) as Colour

FROM users

 

 

Thank you for advance for you help!

 

1 REPLY 1
v-lionel-msft
Community Support
Community Support

Hi @jockycamposeco ,

First, copy the 'user' table in 'Edit Queries', then you have three tables:

b6.PNG

Then, create columns in "User (2) table" :

 

Phone = 
LOOKUPVALUE(
    User_data[value],
    User_data[user_id], User[ID],
    User_data[form_field_id], 3805
     ) 
Address = 
LOOKUPVALUE(
    User_data[value],
    User_data[user_id], User[ID],
    User_data[form_field_id], 3809
     ) 
Color = 
LOOKUPVALUE(
    User_data[value],
    User_data[user_id], User[ID],
    User_data[form_field_id], 3881
     ) 

 

b7.PNG

 

Best regards,
Lionel Chen

 

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors