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
RGCP
New Member

Segmenting customers by two text columns

Hi,

I have a Clients table like this and I want to filter the customers by the "Active" and "Credit" columns, so that only "Active" = "OK" or "Credit" = "OK" customers are selected for the slicer, according to the selected option.

clients.png

 

Then, I want to select one client and put some sales information in to visuals.
I dont know how to filter my clients by "Active" or "Credit" so I can select only clients of that type.
(Edited: when I selected "credit", only customers with "credit" = "OK" would be available for the customer slicer, and when I selected "active", only customers with "credit" = "OK" would be available for the customer slicer, then I could choose the desired customer and present his data in visuals)
Any tip is very appreciated

 

Richard

 

 

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @RGCP ,

 

You will need to create a new table with column "type" as below.

6.PNG

Then create measures as below.

is_active = IF(SELECTEDVALUE('Table'[active])="ok",1,0)

is_credit = IF(SELECTEDVALUE('Table'[credit])="ok",1,0)

Measure = SWITCH(SELECTEDVALUE(slicer[type]),"active",[is_active],"credit",[is_credit])

 You could add the [measure] to visual level filter.

7.PNG

8.PNG

 

Best Regards,

Jay

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

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @RGCP ,

 

You will need to create a new table with column "type" as below.

6.PNG

Then create measures as below.

is_active = IF(SELECTEDVALUE('Table'[active])="ok",1,0)

is_credit = IF(SELECTEDVALUE('Table'[credit])="ok",1,0)

Measure = SWITCH(SELECTEDVALUE(slicer[type]),"active",[is_active],"credit",[is_credit])

 You could add the [measure] to visual level filter.

7.PNG

8.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
PC2790
Community Champion
Community Champion

Hello @RGCP ,

 

You can try this approach:

Create a new calculated colum with the below code:

 

FlagOK = if(OR(ClientsTable[Active] = "OK",ClientsTable[Credits]),"OK", Blank())

You cna then use this slicer and filter the OK records

 

Hello @PC2790 than you for suggestion, but what I wanted was when I selected "credit" only customers with "credit" = "OK" would be available for the customer slicer, and when I selected "active" only customers with "credit" = "OK" would be available for the customer slicer, then I could choose the desired customer and present his data in visuals
Maybe I had not explained myself correctly, sorry about that.
Thanks,

Richard

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.