Forum Discussion
using a slicer to control which attributes a table is filter by
- 4 months ago
Hi KBD ,
For this you need to have a different syntax because when you do ColumnValues == "" or ISBLANK(ColumnnValues) this is expecting a single value to do the comparision since the no selection on a slicer correspond to selecting all then you have an error of multiple values supplied.
Other thing is that having everything selected on the slicer or no selection gives the same result so you have to change your measure to pick up the filtering.
For this try the following code:
Filter Blanks II = VAR __SelectedValue = SELECTCOLUMNS( SUMMARIZE( fields, fields[fields], fields[fields Fields] ), fields[fields] ) var ColumnValues = VALUES(fields[fieldName]) VAR temptable = SELECTCOLUMNS( Sheet1, Sheet1[Employee Name], Sheet1[Employee Id], Sheet1[Expense Description], Sheet1[MCC], Sheet1[Merchant Name], Sheet1[Transaction Date], "Blank count", IF ( ISFILTERED(fields[fields Fields]) , IF( "Employee Name" IN ColumnValues, 1 * ISBLANK(Sheet1[Employee Name]) ) + IF( "Employee ID" IN ColumnValues, 1 * ISBLANK(Sheet1[Employee ID]) ) + IF( "Expense Description" IN ColumnValues, 1 * ISBLANK(Sheet1[Expense Description]) ) + IF( "Transaction Date" IN ColumnValues, 1 * ISBLANK(Sheet1[Transaction Date]) ) + IF( "MCC" IN ColumnValues, 1 * ISBLANK(Sheet1[MCC]) ) + IF( "Merchant Name" IN ColumnValues, 1 * ISBLANK(Sheet1[Merchant Name]) ) ,1 ) ) RETURN MAXX( temptable, [Blank count] )In this case the ISFILTERED allows to show if you have any selection on the filter, be aware that in this case having no selection returns all rows having all values selected in the slicer returns the ones with blanks:
Concerning the first row on your example I was not able to replicate it but seems to be working fine on my side.
Hi KBD ,
The problem in your calculation is that field parameters table because of the way they are built do not return any values when you used SELECTEDVALUE on any of the columns that are crreated at the time. To do this you need to use a workaround described in this article.
https://www.sqlbi.com/blog/marco/2022/06/11/using-selectedvalue-with-fields-parameters-in-power-bi/