Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Creating Relationship between 2 Different Datasets

Let's say I have 2 existing Datasets, one is AnimalInfo and another is Owner. In the Owner dataset (xls. format) consist of 3 sheets aka 3 owners. In the visualization, for instance I have slicer tha...
  • rajendraongole1's avatar
    2 years ago

    Hi Anonymous - you can append these three sheets (Ara,Ken and Eva) into a single table named as Owner

     

    Rename columns appropriately for consistency (e.g., Name of the Pet to Pet Name, Pet to Animal).

     

    create a relationship between owner table and Animal tables as lik below

     

     

    create a new table as 

     

    OwnerMapping =
    DATATABLE (
    "Owner", STRING,
    {
    { "Ara" },
    { "Ken" },
    { "Eva" }
    }
    )

    Now create individual measure for each owner

    Ara_Pets =
    CONCATENATEX (
    FILTER (
    Owner,
    Owner[Owner] = "Ara" &&
    Owner[Animal] = SELECTEDVALUE ( AnimalInfo[Animal])
    ),
    Owner[Pet Name],
    ", ",
    "n/a"
    )

    Ken_Pets =
    CONCATENATEX (
    FILTER (
    Owner,
    Owner[Owner] = "Ken" &&
    Owner[Animal] = SELECTEDVALUE ( AnimalInfo[Animal])
    ),
    Owner[Pet Name],
    ", ",
    "n/a"
    )

    Eva_Pets =
    CONCATENATEX (
    FILTER (
    Owner,
    Owner[Owner] = "Eva" &&
    Owner[Animal] = SELECTEDVALUE ( AnimalInfo[Animal])
    ),
    Owner[Pet Name],
    ", ",
    "n/a"
    )

     

    Hope it works

    Did I answer your question? Mark my post as a solution! This will help others on the forum!
    Appreciate your Kudos!!