Forum Discussion
Active relationship based on Slicer
Hello All,
I have a slicer which has 4 rows these as follows:
Slicer:
1) This month
2)Last Year
3) This year
4) Prev month
and in another table I have columns like this
Country, State, This month, Last Year, This year, Prev month
So i have modeled the data like
(first table )This month--> This month (Second Table)
and Last Year -->Last Year and
This year -->This year and
Prev month--> Prev month
Since a table can have only one active relationship This month--> This month is active.
Can I make Active relation based on the slicer
For Example: If I select "Prior Year" all data must be filtered to prior year ...etc
Thanks
Anonymous you need to unpivot table b and then set the relationship between both the table, after that it will work as expected.
To unpivot, select all column table b excep (those four columns) and right click after selection and clicking unpivot other column, it will give you two column attribute and value (change column name as per your need)
Now set relationship between table 2 with table 1 on attribute and selection.
Now if you filter from selection, you table2 will show respective values.
7 Replies
- parry2k
Super User
Anonymous unfortunaltey you cannot change active relationship on selection but in your dax measure you can use userrelationship function to make other function active based on selection.
- AnonymousNot applicable
Can I create user relationship like a custom column instead of measure, because If I use to measure data is changing as My selection criteria by remaining slicers' data is not getting filtered .
Any Alternate approach to a situation like this?
- parry2k
Super User
Anonymous userrelationship can be only used in measure. I exactly not sure whst you are trying to achieve, if you share sample data and what result you are looking for, it will help to see if there is alternate solution.
- AnonymousNot applicable
Table 1
Id
Selection
1
This month
1
This year
2
Prev MOnth
2
Last Year
Table 2
State
Country
Id
This month
This Year
Prev Month
Last Year
Customer
DOB
I modeled 2 tables as follows:
Table 1 "Selection colum " --> This month
"Selection colum " --> This year (Active relation ship)
"Selection colum " --> Prev month (Non-Active relation ship)
"Selection colum " --> Last year ( non- Active relation ship)
Since a table has only 1 active relation, "Selection column " --> This month is active
now in report, I am using Table 1 "Selection" as a slicer,
and it will display as
This month
This year
Prev Month
Last Year
If I select "this month" in table 1 it should map to "this month" column in table 2 and data must be filtered
if I select "This year " in table 1 it should map to "This year " column in table 2 and data must be filtered
...
Hope this is clear.
Thanks
Aditya
- parry2k
Super User
Anonymous you need to unpivot table b and then set the relationship between both the table, after that it will work as expected.
To unpivot, select all column table b excep (those four columns) and right click after selection and clicking unpivot other column, it will give you two column attribute and value (change column name as per your need)
Now set relationship between table 2 with table 1 on attribute and selection.
Now if you filter from selection, you table2 will show respective values.