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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Danielecc
Helper II
Helper II

How to compare in same table using slicer

I have this table:

 

ProductoCategoria
aH1
aH2
aH3
bH9
bH8
bH2

 

Then, I need create 2 slicer to compare.

The Slicer1 to select one product (example: product "a")

The Slicer2 to select other product (example: product "b")

 

The table of result is:

 

ProductoProductoCategoria
abH9
abH8

 

Here I can see the difference between product "a" and product "b" is only on categories "H8" and "H9".

 

Sorry coz my english is very bad, thans to all for Help

 

 

 

1 ACCEPTED SOLUTION
Danielecc
Helper II
Helper II

I could solve it with this Measure:

 

Categoria_Exclusiva =
VAR Producto1 = SELECTEDVALUE(Tabla1[Producto])
VAR Producto2 = SELECTEDVALUE(Tabla2[Producto])

VAR CategoriaProducto1 =
CALCULATETABLE(
FILTER(
VALUES(Tabla1[Categoria]),
LEFT(Tabla1[Categoria], 3) <> "ZRC" -- Excluir Categoria que comiencen con "ZRC"
),
Tabla1[Producto] = Producto1
)

VAR CategoriaProducto2 =
CALCULATETABLE(
FILTER(
VALUES(Tabla2[Categoria]),
LEFT(Tabla2[Categoria], 3) <> "ZRC" -- Excluir Categoria que comiencen con "ZRC"
),
Tabla2[Producto] = Producto2
)

VAR CategoriaExclusivosProducto1 =
EXCEPT(CategoriaProducto1, CategoriaProducto2)

RETURN
IF(
SELECTEDVALUE(Tabla1[Categoria]) IN CategoriaExclusivosProducto1,
1, -- Es exclusivo
BLANK() -- No es exclusivo
)

View solution in original post

3 REPLIES 3
Danielecc
Helper II
Helper II

I could solve it with this Measure:

 

Categoria_Exclusiva =
VAR Producto1 = SELECTEDVALUE(Tabla1[Producto])
VAR Producto2 = SELECTEDVALUE(Tabla2[Producto])

VAR CategoriaProducto1 =
CALCULATETABLE(
FILTER(
VALUES(Tabla1[Categoria]),
LEFT(Tabla1[Categoria], 3) <> "ZRC" -- Excluir Categoria que comiencen con "ZRC"
),
Tabla1[Producto] = Producto1
)

VAR CategoriaProducto2 =
CALCULATETABLE(
FILTER(
VALUES(Tabla2[Categoria]),
LEFT(Tabla2[Categoria], 3) <> "ZRC" -- Excluir Categoria que comiencen con "ZRC"
),
Tabla2[Producto] = Producto2
)

VAR CategoriaExclusivosProducto1 =
EXCEPT(CategoriaProducto1, CategoriaProducto2)

RETURN
IF(
SELECTEDVALUE(Tabla1[Categoria]) IN CategoriaExclusivosProducto1,
1, -- Es exclusivo
BLANK() -- No es exclusivo
)

bhanu_gautam
Super User
Super User

@Danielecc  Try using

Go to the "Modeling" tab and select "New Table".
Create a new table with the same data as your original table.

 

Table2 = Table1



Go to the "Model" view.
Create a relationship between Table1[Producto] and Table2[Producto].

Add a slicer for Table1[Producto] and another slicer for Table2[Producto] to your report.

 

Create a new measure to identify the categories that are different between the two selected products.
DifferentCategories =
VAR SelectedProduct1 = SELECTEDVALUE(Table1[Producto])
VAR SelectedProduct2 = SELECTEDVALUE(Table2[Producto])
RETURN
CALCULATETABLE(
EXCEPT(
SELECTCOLUMNS(FILTER(Table1, Table1[Producto] = SelectedProduct1), "Categoria", Table1[Categoria]),
SELECTCOLUMNS(FILTER(Table2, Table2[Producto] = SelectedProduct2), "Categoria", Table2


Create a table visual:
Add a table visual to your report.
Use the Producto from Table1, Producto from Table2, and the Categoria from the measure DifferentCategories.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Hi @bhanu_gautam  , thanks for your reply.

I try your solution and I made the other table as you said and related product with product (that was a many to many relationship).

 

I made the measure and in the last line I had an error, but I solved with this change:

SELECTCOLUMNS(FILTER(Table2, Table2[Producto] = SelectedProduct2), "Categoria", Table2[Categoria])))

 

But when I made the Table visual with the products and this measure, doesn't work. The table visual was Empty.

 

Thanks a lot anyway

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.