Forum Discussion

nancyvangrrr's avatar
nancyvangrrr
Frequent Visitor
2 years ago
Solved

Comparing text values from columns in two different Tables

I have two datasets:

 

webfact

PageTags_FactVisitsBounces
fruits.comfresh, frozen11
fruits.comfrozen21
fruits.comfresh, organic, red52
fruits.comfresh, GA21
fruits.comCA71

 

dimSegments

SegmentTags_dim
Fresh or Frozenfresh or frozen
USCA or FL or GA

 

When someone selects Fresh or Frozen from dimSegment, I expect to see this:

PageTagsVisitsBounces
fruits.comfresh, frozen11
fruits.comfrozen21
fruits.comfresh, organic, red52
fruits.comfresh, GA21

 

When someone selects US from dimSegment, I expect to see this:

PageTagsVisitsBounces
fruits.comfresh, GA21
fruits.comCA71

 

dimSegments contains hundreds of Segment and Tag combinations so I would prefer not to manually assign each condition individually. Is there a way to do this via DAX or Power Query? I'm even open to parameters nested in SQL statements via Advanced Editor.

 

This is obviously not correct but this is what my brain has conjured up: 
if Text.Contains(webfact.Tags_Fact, dimSegments.Tags_Dim) then dimSegments.Segment

5 Replies

  • nancyvangrrr I have two videos coming on something similar, maybe that will help meet your requirements. These videos will be published in the next 1-2 days. 

    • nancyvangrrr's avatar
      nancyvangrrr
      Frequent Visitor

      This is brilliant and exactly what I needed. Thank you so much!

  • nancyvangrrr glad it worked out for you - 2nd video is almost ready and will share the link here, and hopefully that will help to extend your solution. This is great news. Cheers!!