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

Adding specific vales to a filtered table

Hi Everyone

I have a table call Customer Table, that has customer names and their Region. I cannot edit the table due to it being a corporte database. The problem i am trying to solved is that when i filter for North America, the table will filtred but there are a 2 customers names in the mexico region, that i need to include in the filter when I filter for North America. I would appreciateany thoughts or ideas how to do this.

 

bu965_0-1631884883360.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

hi, for this specific case, you could create a calculate column in PowerBI with the next formula:

 

Region2 = IF( OR('Customer Table'[Region] = "North America",
OR('Customer Table'[Customer Name] = "Customer Nmae 7",
'Customer Table'[Customer Name] = "Customer Nmae 8")
),"North America",'Customer Table'[Region])

 

You also can create a flag column based in 'Customer Name' Column, and then create a formula with the region and flag column.

 

Customer Name        |   Region            | Flag (Based on Customer Name)

Customer Name 1     | North America  | 0

Customer Name 2     | North America  | 0

.

.

Customer Name 7     | Mexico              | 1

Customer Name 8     | Mexico              | 1

Customer Name 9     | Mexico              | 0

Customer Name 10   | Mexico              | 0

 

Region 2 = If( OR('Customer Table'[Region] = "North America", 'Customer Table'[Flag] = 1),

                             "North America", 'Customer Table'[Region])

 

Regards

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

hi, for this specific case, you could create a calculate column in PowerBI with the next formula:

 

Region2 = IF( OR('Customer Table'[Region] = "North America",
OR('Customer Table'[Customer Name] = "Customer Nmae 7",
'Customer Table'[Customer Name] = "Customer Nmae 8")
),"North America",'Customer Table'[Region])

 

You also can create a flag column based in 'Customer Name' Column, and then create a formula with the region and flag column.

 

Customer Name        |   Region            | Flag (Based on Customer Name)

Customer Name 1     | North America  | 0

Customer Name 2     | North America  | 0

.

.

Customer Name 7     | Mexico              | 1

Customer Name 8     | Mexico              | 1

Customer Name 9     | Mexico              | 0

Customer Name 10   | Mexico              | 0

 

Region 2 = If( OR('Customer Table'[Region] = "North America", 'Customer Table'[Flag] = 1),

                             "North America", 'Customer Table'[Region])

 

Regards

parry2k
Super User
Super User

@Anonymous I'm suggesting adding a column in PQ, not in the database, and most of the time it is a good idea to create views in the backend and have that logic go in the view.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous why not create a new column in PQ for the region with the following expression and then remove the old region column and use the new one

 

if [Region] = "Mexico" then "North America" else [Region]

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi Parry2k, its a corprate database and cannot add or delete columns. I thought about that but found out  that IT will not allow this. Thanks

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.