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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Dynamic Text Column based on another column with multiple return options

Hi - I am having a problem with a column I've created. I have a column in my data that I'd like to use as a filter; however, there are multiple values in this column I'd like to parse out. See table below for how data is being captured:

 

ProductRegion
ASouth
BEast; South
CEast; North; South
DNorth; West

 

I want to create a filter for "Region" but have it only give "North", "South", "East", and "West" as the drop down options. Then, in the Power BI report, I still would like the Region data to show up as is in the table (i.e. details of multiple regions tagged to a product should not be lost, but for ease of filtering I don't want to select 3 different options just to see all products tagged to South). 

 

I'm using the following to create a new column but it's not giving me all the rows tagged to a specific region properly. For example, the following would only return "South" if I clicked on "South" instead of "East; South", etc. as the "East; South" row only shows up if I click on East (it comes first in the code below, but I want to create a code that solves this issue):

Region =

SWITCH(

    TRUE(),

CONTAINSSTRING('Sheet1'[Region],"North")=TRUE(),"North",

CONTAINSSTRING('Sheet1'[Region],"East")=TRUE(),"East",

CONTAINSSTRING('Sheet1'[Region],"West")=TRUE(),"West",

CONTAINSSTRING('Sheet1'[Region],"South")=TRUE(),"South")

 

How can I write a measure or column to pick up all the rows tagged to a specific region? I.e. for the "East; South" example, how can I ensure that when I create a filter with only the 4 regions, when I click on "East" and "South", "East; South" shows up both times? 

 

Thanks in advance!

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey @Anonymous ,

 

my recommendation is using data modeling to tackle your challenge. I derived two additional tables from the column Region of the table you provided, see the screenshot:

image.png

The table unique region string contains unique values of the region column:

TomMartens_0-1686604987674.png

The table slicer starts with the unique values of the region column, this column is duplicated. The duplicated column is renamed to slicer. The transform "Split by delimiter" is used as follows:
image.png
The result:

TomMartens_1-1686605237622.png

Based on these tables you can build the data model from the first picture, pay attention to the cross filter direction.

A report will show you this:

image.png

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

1 REPLY 1
TomMartens
Super User
Super User

Hey @Anonymous ,

 

my recommendation is using data modeling to tackle your challenge. I derived two additional tables from the column Region of the table you provided, see the screenshot:

image.png

The table unique region string contains unique values of the region column:

TomMartens_0-1686604987674.png

The table slicer starts with the unique values of the region column, this column is duplicated. The duplicated column is renamed to slicer. The transform "Split by delimiter" is used as follows:
image.png
The result:

TomMartens_1-1686605237622.png

Based on these tables you can build the data model from the first picture, pay attention to the cross filter direction.

A report will show you this:

image.png

Hopefully, this helps to tackle your challenge.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.