Forum Discussion
Dybamic Filter
- Anonymous1 year ago
Hi, Hifni93
Based on your information, I create a sample table:
Create a new empty query in Power Query and enter the following as a list of column names:
= {"OS_X","DOMINIO_X","INSTALLDATE_X","SEDE_X","LOGICCPU_X","CORE_X"}
Convert this list to a table, click To Table. You can change the column name and table name:Select Close&Apply. Then create a new measure:
Filter Logic = VAR Selected = ALLSELECTED('Dimension Table'[Type]) VAR Logic = IF( COUNTROWS(Selected) > 0, // At least one of the selected columns is 1, and all unselected columns are empty ( ( MAX('Table'[OS_X]) = 1 && "OS_X" IN Selected ) || ( MAX('Table'[DOMINIO_X]) = 1 && "DOMINIO_X" IN Selected ) || ( MAX('Table'[INSTALLDATE_X]) = 1 && "INSTALLDATE_X" IN Selected) || ( MAX('Table'[LOGICCPU_X]) = 1 && "LOGICCPU_X" IN Selected) || ( MAX('Table'[CORE_X]) = 1 && "CORE_X" IN Selected) || ( MAX('Table'[SEDE_X]) = 1 && "SEDE_X" IN Selected) ) && ( ( MAX('Table'[OS_X]) = BLANK() || "OS_X" IN Selected ) && ( MAX('Table'[DOMINIO_X]) = BLANK() || "DOMINIO_X" IN Selected ) && ( MAX('Table'[INSTALLDATE_X]) = BLANK() || "INSTALLDATE_X" IN Selected) && ( MAX('Table'[LOGICCPU_X]) = BLANK() || "LOGICCPU_X" IN Selected) && ( MAX('Table'[CORE_X]) = BLANK() || "CORE_X" IN Selected) && ( MAX('Table'[SEDE_X]) = BLANK() || "SEDE_X" IN Selected) ) , TRUE() ) RETURN IF(Logic = FALSE(), BLANK(), "True")Create a slicer that uses the [Type] field in the newly created dimension table as a slicer, allowing multiple selections. Use the above measures as filter criteria for the table/matrix. When a slicer is selected, only rows with 1 in the selected column and empty columns are displayed. All data is displayed when no slicer is selected. Here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hifni93 , You can have a disconnected table with 1 and 0 value. And then based on value selected you can pass and filter various column.
Countrows(filter(Table, Table[Column1] in values(dim[Values) || Table[Column2] in values(dim[Values) ))
One more option is field paramaters in slicer values
Power BI- Create dynamic slicers using field parameters: https://youtu.be/H2ZxWaHAJZQ
https://medium.com/@amitchandak/power-bi-power-bi-create-dynamic-slicers-using-field-parameters-202587d4dedb