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
JohnAnderson
New Member

Pulling referential label descriptions from label table

New here and new to Power BI.  Working with a 3rd party DB that has many tables with integers stored in many monthly fields (month 1, month 2...)  in each table.  These integer values relate to one table of master labels, value1 = label1 "AA" 2="BB" ... Is there a way (function, command) that will allow me to join these multiple fields into this "Label" table?  My attempts so far only allow me to have 1 join to this table (month1 to value)?  Do I have to handle this as a conversion on the query/model level?

 

Table1, record 1

tbl1.month1=3

tbl1.month2=5

tbl1.month3=1

tbl1.year =2016

...

 

Table1, record 2

tbl1.month1=2

tbl1.month2=1

tbl1.month3=4

tbl1.year=2016

...

 

TableL.record 1

tblL.value=1

tblL.description="AA"

 

TableL.record 2

tblL.value=2

tblL.description="BB"

...

 

 

 

Sorry this seems like something I should be able to figure out but how do I join the fields tbl.month1 and tbl.month2 and ... to tblL.value to get tblL.description on the report?  must be simple and I am just missing something from the training vids but I have not been able to figure it out.  Any help for a newbie would be appreciated.

 

John

 

John

 

3 REPLIES 3
v-yulgu-msft
Employee
Employee

Hi @JohnAnderson,

 

Have you worked it out? If so, would you please mark the helpful reply as an answer so that it can benefit more users? If you still have any question, please feel free to ask.

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yulgu-msft
Employee
Employee

Hi @JohnAnderson,

 

Based on my understanding, your table structure might be:

1.PNG  2.PNG

 

To Join these two tables based on values for each month in Table1 and [Value] in TableL, you should first Unpivot Table1. Select columns Month1, Month2, Month3... then, click "Unpivot Columns" option under Transform tab in Query Editor mode.

3.PNG

 

Then, merge these two tables. (Home -> Merge queries as new)

4.PNG

 

5.PNG

 

If above result doesn't meet your requirement, please figure out how to join tables and show us your desired output with image.

 

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ImkeF
Super User
Super User

Hi John,

it would be easiest if you unpivot the month-columns of your Table1, then merge the TableL on the (newly created) attribut-column, and - if necessary - pivot back.

But normally, the pivot-back operation is not such a good idea for a data model.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

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.