简体   繁体   中英

Power BI - How to manage relationship between 2 tables for 1 to many rows

I have 2 tables

Table A

Category Type   Start time  Severity Status
Issue           July 2019   High    Closed
Config          July 2019   Low     Closed
Config          July 2019   High    Open
Bug             Sep 2020    Medium  Open
Training        Aug 2020    High    Open
Config          Sep 2020    Low     Closed 
Config          Sep 2020    Medium  Closed
Config          Oct 2020    Low     Open
Config          Oct 2020    Low     Closed
Config          Oct 2020    Medium  Open

Table B

Category Type   Start time  value
Issue           July 2019   1
Config          July 2019   2
Bug             Sep 2020    1
Training        Aug 2020    3
Config          Sep 2020    2 
Config          Oct 2020    3

I have created a Column Chart with Table B having month on X-axis and Category with count on Y-axis and Table A is simple table chart.

Now when I select Category "Config" in July 2019 which has value "2" on column chart, it shows all the 7 config records in other table instead of only 2 of that July 2019 month which I have selected.

What should I do that it shows only those 2 July 2019 records instead of all the same category type records in other table? There is no 1 to 2 row active relationship is possible in Power Bi Currently I am having 1-1 relationship between category type in both tables.

Thanks In advance.

you can create a new column in both table by concatenating Category type and Month column in both table and creating a join on that new column.

在此处输入图像描述 Image 1
Sheet 1: Concat = Concat = Sheet1[Category Type] &"-"& Sheet1[Start Time].[Month] &"-"& Sheet1[Start Time].[Year]

Sheet 2: Concat = 'Sheet2'[Category Type] &"-"& 'Sheet2'[Start Time].[Month] &"-"& 'Sheet2'[Start Time].[Year]

在此处输入图像描述 Image 2 - Displaying data in both table without any selection or filter

在此处输入图像描述 Image 3 - Displaying data after selecting row for Category type as 'config' and start time as 'July 2019'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM