Filtered table based on multiple values from enum list

Hello to everyone,

I created a details view where i can filter values from another table. 

This only works if I select a single value from the enum list column "Sub category".

On the other hand, if you select more than one value from the eunm list column, I don't see anything.

Schermata 2022-07-14 alle 11.05.42.png

Schermata 2022-07-14 alle 11.06.05.png

This is the formula in slice to filter values:

AND(
IF(ISBLANK(ANY(DB[Category])), TRUE,
[Category]=ANY(Cerca_DB[Category])),

IF(ISBLANK(ANY(DB[Sub Category])), TRUE,
[Sub Category]=ANY(Cerca_DB[Sub Category])),

IF(ISBLANK(ANY(DB[BSR])), TRUE,
[BSR]>=SUM(Cerca_DB[BSR min])),

IF(ISBLANK(ANY(DB[BSR])), TRUE,
[BSR]<=SUM(Cerca_DB[BSR max]))

IF(ISBLANK(ANY(DB[Revenue])), TRUE,
[Revenue]>=SUM(Cerca_DB[Revenue min])),

IF(ISBLANK(ANY(DB[Revenue])), TRUE,
[Revenue]<=SUM(Cerca_DB[Revenue max]))

)

how can i see all the values ​​i select in the enum list column?

TKS

 

 

 

 

Solved Solved
0 3 204
1 ACCEPTED SOLUTION

Maybe instead of

IF(ISBLANK(ANY(DB[Sub Category])), TRUE,
[Sub Category]=ANY(Cerca_DB[Sub Category]))

you could try this

IF(ISBLANK(ANY(DB[Sub Category])), TRUE,
IN([Sub Category], SPLIT(Cerca_DB[Sub Category],","))
)

View solution in original post

3 REPLIES 3

A few things:

1)  You don't mention which table you are filtering.  It matters to make sure you are applying your specified filter criteria properly.

2)  It's not clear if you are trying to filter all rows that match any of the criteria  or if you want to filter any rows that match ALL of the criteria

3)  In each of your criteria you check ISBLANK(DB[column value]).  I assume DB is the user supplied filter criteria?  But you don't use this to perform any actual filtering

4) The ANY() function returns just a single value from a list.  In fact, it returns the FIRST value in the list.  So your usage of ANY(Cerca_DB[column]) is probably not returning what you think.  

5) Your Sub Category portion of the expression is trying to compare a List to a single value.   It works when you select one value but when you select more it will never be equal - multiple values will never equal a single value.  If your intention is to simply check if any of the values in the Sub Category list appear in any of the rows in the table, you will want to use the Intersect() function:

IF(ISBLANK(ANY(DB[Sub Category])), TRUE,
COUNT(INTERSECT([Sub category], Cerca_DB[Sub Category])) > 0),

***********

From here I would recommend describing in words what you are trying to accomplish and what tables you have to do it with.  Then we can help sharpen your expression.

Maybe instead of

IF(ISBLANK(ANY(DB[Sub Category])), TRUE,
[Sub Category]=ANY(Cerca_DB[Sub Category]))

you could try this

IF(ISBLANK(ANY(DB[Sub Category])), TRUE,
IN([Sub Category], SPLIT(Cerca_DB[Sub Category],","))
)

tks very much!! @Suvrutt_Gurjar 

Top Labels in this Space