Forum Discussion

Anonymous_KH's avatar
Anonymous_KH
Frequent Visitor
3 years ago
Solved

Using DAX How to Create a new table from existing tables

Hello Power BI community,

 

A very simple question on creating a new table in Power BI.

Please find below as a data

 

Table 1

| CANDY | OFFICE |
|--------|------------|
| Nomi | Challakere |
| Sinnu | Durga |
| Toli | Shimoga |
| Naky | Loli |
| Toli | Burgi |

 

Table 2

 

| OFFICE | PRODUCER ID |
|------------|-------------|
| Challakere | 1 |
| Durga | 2 |
| Shimoga | 3 |
| Loli | 4 |
| Burgi | 5 |

 

So i want New table with Column (candy) from table 1 and (Producer id ) from table 2

 

 

  • PaulDBrown's avatar
    PaulDBrown
    3 years ago

    Try:

    Table 3 =
    SELECTCOLUMNS (
        'Table 1',
        "Candy", 'Table 1'[CANDY],
        "Producer", LOOKUPVALUE ( 'Table 2'[PRODUCER ID], 'Table 2'[OFFICE], 'Table 1'[OFFICE] )
    )
    

     

3 Replies

  • you can use merge queries as nwe and select required colmns in PQE. otherwise use joins in DAX

      • PaulDBrown's avatar
        PaulDBrown
        Community Champion

        Try:

        Table 3 =
        SELECTCOLUMNS (
            'Table 1',
            "Candy", 'Table 1'[CANDY],
            "Producer", LOOKUPVALUE ( 'Table 2'[PRODUCER ID], 'Table 2'[OFFICE], 'Table 1'[OFFICE] )
        )