Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
dasingh9
Frequent Visitor

Multiple Relationships on two tables for filtering data

Hi, I am concerned about creating multiple relationships between my two tables (Students and Tags List) and filtering the values of Students table based on a slicer using Tags List table.

 

I am using a column chart to display the number of students for each faculty (refer screenshots) and I want to filter the chart data using a slicer of Tags List (International, Domestic, Postgraduate, Undergraduate).

 

Currently, I am able to filter the values for Tag1 relation only (Postgraduate,  Undergraduate), however, the filter is not working for Domestic or International.

 

1) Here is the download link to Faculty_Wise_Report.pbix file

2) Here is the download link to Sample Data

 

Tables / Relationships:
Students[Tag1] --> Tags List[Tag Name]
Students[Tag2] --> Tags List[Tag Name]


Tables and RelationshipsTables and Relationships

Report OutputReport OutputHere is the structure of my tables.

 

Table 1: Students

Student IDNameCourseFacultyTag1Tag2
101AMaster of ArtsArtsPostgraduateInternational
102BBachelor of ArtsArtsUndergraduateDomestic
103CMaster of CommerceBusinessPostgraduateInternational
104DBachelor of CommerceBusinessUndergraduateDomestic
105EMaster of ScienceSciencePostgraduateInternational

 

Table 2: Tags List

Tag Name
Postgraduate
Undergraduate
International
Domestic

 

Cheers,

Davinder

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @dasingh9,

 

Only one active relationship can be existing between two tables. In this scenario, it's based on [Tag1] and [Tag Name]. So, the slicer can filter on [Tag1] only, when you choose Domestic or International, the chart visual shows blank as there is no corresponding records in [Tag1].

 

For your requirement, plesae new a calculated table. Create a one to many relationship between this table and Tag list table based on [Tag] field.

Students2 =
UNION (
    SELECTCOLUMNS (
        Students,
        "Student ID", Students[Student ID],
        "Name", Students[Name],
        "Course", Students[Course],
        "Faculty", Students[Faculty],
        "Tag", Students[Tag1]
    ),
    SELECTCOLUMNS (
        Students,
        "Student ID", Students[Student ID],
        "Name", Students[Name],
        "Course", Students[Course],
        "Faculty", Students[Faculty],
        "Tag", Students[Tag2]
    )
)

1.PNG

 

Drag fields from 'Students2' to chart visual.

 

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @dasingh9,

 

Only one active relationship can be existing between two tables. In this scenario, it's based on [Tag1] and [Tag Name]. So, the slicer can filter on [Tag1] only, when you choose Domestic or International, the chart visual shows blank as there is no corresponding records in [Tag1].

 

For your requirement, plesae new a calculated table. Create a one to many relationship between this table and Tag list table based on [Tag] field.

Students2 =
UNION (
    SELECTCOLUMNS (
        Students,
        "Student ID", Students[Student ID],
        "Name", Students[Name],
        "Course", Students[Course],
        "Faculty", Students[Faculty],
        "Tag", Students[Tag1]
    ),
    SELECTCOLUMNS (
        Students,
        "Student ID", Students[Student ID],
        "Name", Students[Name],
        "Course", Students[Course],
        "Faculty", Students[Faculty],
        "Tag", Students[Tag2]
    )
)

1.PNG

 

Drag fields from 'Students2' to chart visual.

 

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
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.