Forum Discussion
How to compare in same table using slicer
- 1 year ago
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
)
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.
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