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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Raul
Post Patron
Post Patron

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:

C1.JPG

 

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

 

C2.JPGC3.JPG

 

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.

1 ACCEPTED SOLUTION
v-cherch-msft
Employee
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 )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
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

2 REPLIES 2
v-cherch-msft
Employee
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 )
)

1.png

 

Regards,

Cherie

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

Thanks a lot @v-cherch-msft  for  your reply.

The second option, I think that can be works for me. 

See you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.