Forum Discussion
Creating a relationship between multiple columns in one table with one column in another
Hi,
I'm new to power bi. I have two tables that I want to create a relationship between.
The first has 8 countries going across the columns. The second table contains those same 8 countries in the first column coming down in rows. I want to create a relationship so that when I click on one of the countries in a graph representing the data in the first table, only the data related to that country appears from the second table in another graph. Is this possible?
4 Replies
- amitchandakSuper User
Not sure, why you have eight countries in 8 columns. But it means you have either unpivot data or use userelation to choose join in your formulas
Refer for unpivot : https://radacad.com/pivot-and-unpivot-with-power-bi
Refer to how to use userelation. This on dates but you can do same for countries
HR-Analytics-Active-Employee-Hire-and-Termination-trend
Use the date calendar, if you are not using
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges
Connect on Linkedin - VasTgMemorable Member
Anonymous
Could you post the sample data for both the input tables and expected graphs?
- v-juanli-msftCommunity Support
Hi Anonymous
Check the reply of amitchandak,
Unpivot feature is under Edit queries->Transform, only select that columns where "countries" exsit.
This will make the columns into one column, then create relationships betwen two tables based on the column.
Feel free to let me know if you have any problem.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - v-juanli-msftCommunity SupportHi AnonymousIs this problem sloved?If it is sloved, could you kindly accept it as a solution to close this case?If not, please let me know.Best RegardsMaggie