Forum Discussion

KCB's avatar
KCB
New Member
5 years ago
Solved

Need help to solve a problem with fetching multiple values for each single value

Hello everyone,

 

I have a problem I need help with.

 

I have 2 tables, 1 table has all the item numbers and 1 table has all the customer numbers, in this case, I wish to be able to get all item numbers for each customer using DAX.

 

 

Example:

 

Table 1               Table 2                  Result 

 

A                         1                           A 1

B                         2                           A 2

C                         3                           A 3   

D                         4                           A 4  

                                                        B 1

                                                        B 2   

                                                        B 3  

                                                        B 4

                                                        C 1

                                                        C 2   

                                                        C 3  

                                                        C 4

                                                        D 1

                                                        D 2   

                                                        D 3  

                                                        D 4

 

 

All help would be very appreciated here 🙂

  • KCB 

    Go to the modeling tab and click on New Table and try the following code, rename table and column names. as per our model

     


    NEW TABLE = 


    GENERATE(
     VALUES(TABLE1[CUSTOMER NUMBER]),
     VALUES(TABLE2[ITEM NUMBER])
    )

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

4 Replies

  • KCB 

    Go to the modeling tab and click on New Table and try the following code, rename table and column names. as per our model

     


    NEW TABLE = 


    GENERATE(
     VALUES(TABLE1[CUSTOMER NUMBER]),
     VALUES(TABLE2[ITEM NUMBER])
    )

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn

    • KCB's avatar
      KCB
      New Member

      Thank you for your fast replay,

       

      This worked so then I have 2 follow up questions to this method.

       

      1. Will this table now update itself when I update the customer table and the product table?

      2. is it possible to do this using a measure to save space?

       

      thank you so much for your help so far :).

      • Fowmy's avatar
        Fowmy
        Icon for Super User rankSuper User

        KCB 

        For
        Q # 1, Yes, it will get updated,
        Q#2, I recommend you to use a table instead of measure as I shared, it will not consume much space as you have two columns.

         

        ________________________

        If my answer was helpful, please consider Accept it as the solution to help the other members find it

        Click on the Thumbs-Up icon if you like this reply 🙂

        YouTube  LinkedIn