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
sirros_iot
Helper IV
Helper IV

Creating a new table with substituted values

Hello all,

 

I have a table that contains two types of values that are shown in the same column, one is the product and the other is the KIT(more than one product). Both have the same number type.

Table2Types.PNG

 

I can differentiate them using this table as a reference, like, IF ('Table1'[Produto] = 'Table2'[Cod Kit Produto]; "KIT"; "Produto")

 

KitReference.PNG

 

I would like to replace all the KITs to them components in the 'Table1' keeping the consecutive columns values at the 'Table1'. It would return me a new 'Table1' with the kit number replaced with the kit components. If anyone know a way to solve it, I would appreciate. Regards, Diego

 

KitComponents.PNG

1 ACCEPTED SOLUTION

@sirros_iot

 

Hi, Please check the video.

 

 

Note: I merge in the same Query..But to obtain a new Table you can apply "Merge as New Query"

 

Let me know if need more help

 

Regards

 

Victor

Lima - Peru




Lima - Peru

View solution in original post

10 REPLIES 10
Greg_Deckler
Super User
Super User

Tough to see your screen shots and can't easily copy the data but I would look at LOOKUPVALUE function.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

LOOKUPFUNCTION in M?

 

Thanks for the reply

No, that's DAX. Not sure how you would get there with M, that's going to be tricky because you are dealing with multiple tables. Most M queries only deal with a single table. Definitely possible, you would just have two "Source" lines in your table. Probably possible, but that's an issue for someone such as @ImkeF.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Ok, I will see it, maybe using SUMMARIZE?

 

I already have it, that classify the product.

Summarize.PNG

@sirros_iot

 

Hi. let me try to help you.

 

Imagine You Have 2 Tables:

 

Table 1

 

CODPROD  DESCRIPTION PRICE

 

100                  PROD1     100

2000                PROD2     80

201                  PROD3     70

3000               PROD4       90 

202                 PROD5      50

 

Table 2

 

CODPROD  DESCRIPTION PRICE

 

2000             PART1KIT1   10

2000             PART2KIT1   15

1500            PARTKIT10    20

1800           PARTKIT11    18 

3000          PART2KIT1     11

3000          PART3KIT1     15

 

What is the result that you want to obtain.

 

Regards

Victor




Lima - Peru

Table 1

 

CODPROD  DESCRIPTION PRICE

 

100                  PROD1     100

2000                PROD2     80

201                  PROD3     70

3000               PROD4       90 

202                 PROD5      50

 

Table 2

 

CODPROD  DESCRIPTION PRICE

 

2000             PART1KIT1   10

2000             PART2KIT1   15

1500            PARTKIT10    20

1800           PARTKIT11    18 

3000          PART2KIT1     11

3000          PART3KIT1     15

 

.........................................................................

CODPROD SALES

1             PROD2             3

2             PROD4             1

3             KIT1                  2

4             KIT10                5

5             PROD1              4

 

NEW CODPROD SALES

 

Order

1             PROD2             3

2             PROD4             1

3             PART1KIT1        2

4             PART2KIT1        2

5             PART3KIT1        2

6             PARTKIT10        5

7             PROD1              4

Better...

 

KITCOMPONENTS..................................

 

CODKIT             COMPONENTS                 CODPROD

 

1001                           

1001                           PROD1                         1

1001                           PROD2                         2

1001                           PROD3                         3

1002                           

1002                           PROD5                         5

 

CODPROD SALES.......................................

 

ORDER    CODPROD        VALUE


1             2                       3

2             4                       1

3             1001                 2

4             1002                 5

5             1                       4

 

NEW CODPROD SALES.......................................

 

ORDER    CODPROD        VALUE

 

1             2                       3

2             4                       1

3             1                       2

4             2                       2

5             3                       2

6             5                       5

7             1                       4

@sirros_iot

 

Hi, Please check the video.

 

 

Note: I merge in the same Query..But to obtain a new Table you can apply "Merge as New Query"

 

Let me know if need more help

 

Regards

 

Victor

Lima - Peru




Lima - Peru

Thanks Vitor, it works very well Smiley Very Happy

 

Good afternoon!

 

Regards,

Diego

 

RS, Brazil

LOOKUPVALUE*

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.