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.
Miguel:
I worked replicated you suggestion and we are so close. Much close than I ever would have gotten.
My mock up data
| Trans Id | Transaction Date | MCC | Merchant Name | Employee Id | Employee Name | Expense Description | Amount |
| 000009842692378 | 2/3/2025 | 5942 | Book store | 16252 | Donald Duck | 84.10 | |
| 000011414319771 | 6/6/2025 | 5065 | Electrical Parts | 97427 | Micky Mouse | extension cord | -71.38 |
| 000009452479682 | 8/8/2025 | 5251 | Local Hardware Store | 930758 | Superman | KEYS | 146.08 |
| 000011361076005 | 11/11/2025 | 5251 | Local Hardware Store | 95464 | Batman | Caulking | 449.90 |
| 000011387100331 | 10/10/2025 | 5251 | Local Hardware Store | Hammer | 163.85 | ||
| 000011409252487 | 12/12/2025 | 5251 | Local Hardware Store | 97678 | Green Hornet | Drill Bit | 111.82 |
| 000011476894343 | 1/10/2026 | Local Hardware Store | 096284 | Poison Ivy | 1"pip | -26.58 | |
| 000009747145596 | 1/12/2026 | 5251 | Local Hardware Store | **bleep** Tracy | 118.63 | ||
| 000011569009247 | Local Hardware Store | 94474 | Wonder Woman | Adjustable Wrench | 185.18 | ||
| 000011692905669 | 3/10/2026 | 5251 | Local Hardware Store | 11066 | Under Dog | 144.84 | |
| 000011872913685 | 3/17/2026 | 5039 | Plumbing Supply | PUMP PARTS | 62.99 | ||
| 000011878834281 | 4/4/2025 | 5039 | Plumbing Supply | 930276 | Spider Man | PUMP PARTS | 37.56 |
| 000011878834277 | 5039 | Plumbing Supply | 95455 | The Flash | 12.57 | ||
| 000010078708642 | 5/5/2025 | 5039 | Plumbing Supply | The Flash | MISC PLUMBING SUPPLIES | 79.51 |
Parameter field:
fields = {
("Employee Id", NAMEOF('Sheet1'[Employee Id]), 0),
("Employee Name", NAMEOF('Sheet1'[Employee Name]), 1),
("Expense Description", NAMEOF('Sheet1'[Expense Description]), 2),
("MCC", NAMEOF('Sheet1'[MCC]), 3),
("Merchant Name", NAMEOF('Sheet1'[Merchant Name]), 4)
}With addition attribute as suggested
fieldName = fields[fields]
Looks like this
Now for the measure:
Filter Blanks = 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(
"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])
)
)
RETURN
MAXX(
temptable,
[Blank count]
)
Above measue is created in my transaction table. Do no know if that matters.
Add above measure to my table , my viz.
Create a filter on the viz
Filter Blanks greater than zero.
The above works. It even works if I select multiple appributes
Ie. Employee Name & Expense Description.
Very Nice
continuing on the above
Problem:
If I clear the attribute selection clear fields
Not all records are displayed
Get a table that looks like this.
only the records with missing data are showing
And there is an extra row at the top. Don't know where that is coming from.
So I tried to fix this issue .
Tried to modify the measure so that if no attributes are select Filter Blanks is set to zero on all rows
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 (
ISBLANK(ColumnValues ) || ColumnValues == "" ,
0
) +
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])
)
)
RETURN
MAXX(
temptable,
[Blank count]
)
This is my change
Wanted to set Filter Blanks to zero for all rows if nothing is selected in fields.
Does NOT work.
If I add to my table I get
this is beyond me.
Many thanks for your attention to this matter.
Believe we are close.
KBD
- MFelix4 months ago
Super User
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.
- KBD4 months ago
Helper III
Miguel:
You are the man.
That worked.
Many thanks
KBD