Forum Discussion
using a slicer to control which attributes a table is filter by
- 5 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.
Based on the articule Miguel Félix pointed me to I tried the following
Using the following DAX:
showIfEmptyfixed = VAR __SelectedValue =
SELECTCOLUMNS (
SUMMARIZE ( missingDetails, missingDetails[missingDetails], missingDetails[missingDetails Fields] ),
missingDetails[missingDetails]
)
RETURN
__SelectedValue I get display field name, from the parameter table, selected on each row in my table. Progress
If I use the following:
showIfEmptyfixed = VAR __SelectedValue =
SELECTCOLUMNS (
SUMMARIZE ( missingDetails, missingDetails[missingDetails], missingDetails[missingDetails Fields] ),
missingDetails[missingDetails]
)
RETURN
SWITCH( __SelectedValue ,
"ACCOUNT NAME", ISBLANK(MAX ('PCard_Trans'[ACCOUNT NAME])),
"EMPLOYEE ID", ISBLANK(MAX('PCard_Trans'[EMPLOYEE ID])),
"MERCHANT NAME", ISBLANK(MAX('PCard_Trans'[MERCHANT NAME])),
"TRANSACTION DATE", ISBLANK(MAX('PCard_Trans'[TRANSACTION DATE])),
"MCC", ISBLANK(MAX('PCard_Trans'[MCC])),
"EXPENSE DESCRIPTION", ISBLANK(MAX('PCard_Trans'[EXPENSE DESCRIPTION])),
FALSE()
) The values returned True/false do NOT correspond to the attribute selected. Strange
Thanks for your attention to this matter.
KD