Forum Discussion

jlarques's avatar
jlarques
Icon for Helper V rankHelper V
6 years ago
Solved

Create a new column from other column

Dear all,

I have a table with many millions of rows and I want to extract a data master to connect it with the budget table. 

The DAX formula is:

KIT CATEGORY=
      DISTINCT(

           SELECTEDCOLUMNS(

                KIT;

                "COUNTRY"; KIT[COUNTRY];

                "PRODUCT";KIT[PRODUCT];

                "TYPE"; KIT[TYPE]

            )

       )

But an error message appears related to the relationship:

 

Apologies because it's in Spanish.

Thank you to everybody!! 

  • az38's avatar
    az38
    6 years ago

    jlarques 

    modifying data source is the best solution ever 🙂

    do not hesitate to give a kudo to useful posts and mark solutions as solution

12 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    Hi jlarques 

    show us relationship between tables please. the issue is somewhere around it

    do not hesitate to give a kudo to useful posts and mark solutions as solution
    Linkedin

    • jlarques's avatar
      jlarques
      Icon for Helper V rankHelper V

      Hi az38

      it was no relationship but I created:

      - From Kit[Product] to Kit Category[Product] many to one.

      The error only appears when I want to add the Type column. If I deleted it, I have a table named Kit Category with two columns; Country and Product.

       

      Thanks for your help.

      • az38's avatar
        az38
        Icon for Community Champion rankCommunity Champion

        so, jlarques 

        as i understand it works without type column because each product in your data source has the only category.

        but when you add "type" column, you get a few rows with the same product and category but with different types

        as you have a many-to-one relations it became impossible, because many product from Kit table have relations with many products from Kit Category

         

        for my point, the best solution is to create in Kit table calculated column 

         

        SurrogateKey = concatenate('Table'[Product];concatenate('Table'[Category];'Table'[Type]))

         

        then try to build a master table:

         

        KIT CATEGORY=
              DISTINCT(
                        KIT[SurrogateKey]
               )

         

        and create a relationship many-to-one by this SurrogateKey field

        do not hesitate to give a kudo to useful posts and mark solutions as solution
        Linkedin

         

  • Hi az38 

    yes, I'm sure, but let me check with time and I'll tell you something.

     

    Thanks for all your help and time! You gave me an answer very fast! I'll mark your solution as a solution if it's working well.

     

    Thanks again!

    • jlarques's avatar
      jlarques
      Icon for Helper V rankHelper V

      az38 

      same error, but don't worry. I'll try to put it in another way. I thought was easier to get the data from another table to have a master.

       

      Thanks again for all your help! I'm going to fight with this issue and I'll publish the solution if I find it!

       

      Regards,

       

       

      José Luis

      • jlarques's avatar
        jlarques
        Icon for Helper V rankHelper V

        az38 

        thanks again for your quick answer last week.

         

        Finally, I spoke with the IT department to modify the data source and I got the data exactly as I wanted it.

         

        Again, very grateful for all your help.

         

        Regards,

         

         

  • Icey's avatar
    Icey
    Icon for Community Support rankCommunity Support

    Hi jlarques ,

    Glad to hear that. Please accept your solution above so that people who may have the same question can get the solution directly.

     

    Best Regards,

    Icey