Forum Discussion
How can I join tables with a condition?
Hello everyone!
I have 2 tables (AREAS and CALENDAR) and I want to join this tables with a condition:
- If year it's less or equal 2017, links with a values of the Areas tabla and
- If year it's greater or equal 2018, links with anothers values of the Areas table
Something like this:
So that when you filter for one year (for example 2017) you only show the values of that year (A1, A2 and A5) in another filter and when you filter for another year (for example 2018), your corresponding values (A1, A3, A4 and A5).
Is it possible create a measure for this situation? Is it possible filter a slicer with a condition for this case? Or may be I have to create a third table to link the others two?
Thank you for your help.
Hi Raul
It is impossible to filter a slicer with a condition for this case. First way as you said, create a third table to link the others two. Second way, try to create a measure to get the table as requested. For example:
Measure = SWITCH ( SELECTEDVALUE ( 'Calendar'[year] ), 2017, IF ( MIN ( Area[Area] ) IN { "A1", "A2", "A5" }, 1 ), 2018, IF ( MIN ( Area[Area] ) IN { "A1", "A3", "A4", "A5" }, 1 ) )Regards,
Cherie
2 Replies
- v-cherch-msft
Microsoft Employee
Hi Raul
It is impossible to filter a slicer with a condition for this case. First way as you said, create a third table to link the others two. Second way, try to create a measure to get the table as requested. For example:
Measure = SWITCH ( SELECTEDVALUE ( 'Calendar'[year] ), 2017, IF ( MIN ( Area[Area] ) IN { "A1", "A2", "A5" }, 1 ), 2018, IF ( MIN ( Area[Area] ) IN { "A1", "A3", "A4", "A5" }, 1 ) )Regards,
Cherie
- Raul
Post Patron
Thanks a lot v-cherch-msft for your reply.
The second option, I think that can be works for me.
See you!