Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Try your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now

Reply
KBD
Helper III
Helper III

using a slicer to control which attributes a table is filter by

Hello All:

 

I have transaction data, lets say it is petty cash purchases.  

I am using slicers to filter the table on the fly.

The usual slicers, department,  party making purchase, day of week,  purchase date, merchant.

This works just fine.

 

On top of this, I need to add, basic data quality , check for attributes that are empty.

Ie.  department,  party making purchase,  merchant, description.  A half dozen attribues in total.

Important:  the filter for empty attibutes shold not "blow away" other slicer filters set by the user.

 

Issue:

Cannot, after reading various posting and experimenting cannot get it to work.

 

What I have done.

Create a Field parameter  

missingDetails = {
("ACCOUNT NAME", NAMEOF('PCard_Trans'[ACCOUNT NAME]), 0),
("EMPLOYEE ID", NAMEOF('PCard_Trans'[EMPLOYEE ID]), 1),
("MERCHANT NAME", NAMEOF('PCard_Trans'[MERCHANT NAME]), 2),
("TRANSACTION DATE", NAMEOF('PCard_Trans'[TRANSACTION DATE]), 3),
("MCC", NAMEOF('PCard_Trans'[MCC]), 4),
("EXPENSE DESCRIPTION", NAMEOF('PCard_Trans'[EXPENSE DESCRIPTION]), 5)
}

 

 

 

create a slicer for missingDetails.  so the user can select the attribute to filter on.

Added a textbox that displays the field selected.  

above works I can select fields in missDetails slicer and the text box shows the field selected.

 

Now I believe I need a measure that will calc'ed based on the attribute selected and 

the value of the attirbute by row.

 

Have made two attempts as follows:.

ShowIfEmpty =
VAR SelectedFieldVal = SELECTEDVALUE( missingDetails[missingDetails Fields] )
RETURN
IF(ISBLANK(SelectedFieldVal), 1, 0)

 

 

showIfEmptyII = IF(ISBLANK(SELECTEDVALUE('missingDetails'[missingDetails Fields]) ), 1, 0 )

 

These measures always return zero, therefore useless for filtering.

Other attempts yeild this error:

"column is part of a composite key, but not all columns of the composite key are included in the expression"

 

I am at a stand still, no idea how to proceed.

 

Thanks for your attention to this matter.

 

KD

1 ACCEPTED SOLUTION

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:

 

MFelix_0-1778696240167.png

MFelix_2-1778696289434.png

 

MFelix_1-1778696254203.png

 

 

Concerning the first row on your example I was not able to replicate it but seems to be working fine on my side.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





View solution in original post

20 REPLIES 20
v-agajavelly
Community Support
Community Support

Hi @KBD ,

Just following up on this. Were you able to test the suggested approach? If it worked, marking the helpful reply as a solution would benefit others with a similar scenario.

If you're still facing any issues or seeing unexpected behavior, please share a small example or details we’re happy to help further.

Thanks,
Akhil.

 

Followed up on the suggestions and nothing worked.

My requirement is very simple  do NOT understand why Power BI makes this difficult.

 

KBD

Hi @KBD,

 

Apologies for the additional questions but just want to understand that I have the proper understanding of your need.

 

In you table 'PCard_Trans' there are some atributes that are blank and you want to return the rows that have that specific attribute blank out, in this case you want to select on the field parameter the specific attributes that are blank is that it?

 

Can there be more than one attribute selected?

The final result is a table with the information displaying the information that is missing or an ID, or another way to identify in wich rows they are missing?

 

Can you provide an example on the expected result.

 

Once again I apologize for the question but maybe I'm missing something on your request.

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





I have records for transactions that may have missing data.  

Ie transaction date could be missing (null)

    expense description could be missing (null)

    merchant name could be missing (null)

   or

   expense description and merchant name could be missing.

 

To select the attibute I want to look at 

I have a field selector as follows:

missingDetails = {
    ("ACCOUNT NAME", NAMEOF('PCard_Trans'[ACCOUNT NAME]), 0),
    ("EMPLOYEE ID", NAMEOF('PCard_Trans'[EMPLOYEE ID]), 1),
    ("MERCHANT NAME", NAMEOF('PCard_Trans'[MERCHANT NAME]), 2),
    ("TRANSACTION DATE", NAMEOF('PCard_Trans'[TRANSACTION DATE]), 3),
    ("MCC", NAMEOF('PCard_Trans'[MCC]), 4),
    ("EXPENSE DESCRIPTION", NAMEOF('PCard_Trans'[EXPENSE DESCRIPTION]), 5)
}

Field selector is in a slicer.

    

If the user selects Employee Id, I want the table to be filtered by 

Filter on Visual

Employee Id is Null or Employee ID = ""

 

If the user selects MCC, I want the table to be filtered by 

Filter on Visual

MCC is Null or MCC = ""

 

I will work on some mocked up data that I can post.

 

Thanks for your interest in this issue.

 

KBD

Hi @KBD ,

 

I believe I was able to mockup your model I have the following table:

MFelix_0-1778598297018.png

 

Has you can see I have several fields that are blanked I also created a Parameter table like the one you have:

MFelix_1-1778598420937.png

 

However in this table I have added a new column Name that is just the parameter value this is just to simplify the next measure:

MFelix_2-1778598452829.png

Now I added this measure:

Filter Blanks = VAR __SelectedValue =
		SELECTCOLUMNS(
			SUMMARIZE(
				Parameter,
				Parameter[Parameter],
				Parameter[Parameter Fields]
			),
			Parameter[Parameter]
		)

    var ColumnValues = VALUES(Parameter[Name])
	
    VAR temptable =
		SELECTCOLUMNS(
			PCard_Trans,
			PCard_Trans[Account Name],
			PCard_Trans[Employee ID],
			PCard_Trans[Expense Description],
			PCard_Trans[MCC],
			PCard_Trans[Merchant Name],
			PCard_Trans[Transaction Date],
			"Blank count", 
              IF(
				"Account Name" IN ColumnValues,
				 ISBLANK(PCard_Trans[Account Name])
			) +
			IF(
				"Employee ID" IN ColumnValues,
				ISBLANK(PCard_Trans[Employee ID])
			) +
			IF(
				"Expense Description" IN ColumnValues,
				 ISBLANK(PCard_Trans[Expense Description])
			) +
			IF(
				"Transaction Date" IN ColumnValues,
				 ISBLANK(PCard_Trans[Transaction Date])
			) +
			IF(
				"MCC" IN ColumnValues,
				 ISBLANK(PCard_Trans[MCC])
			) +
			IF(
				"Merchant Name" IN ColumnValues,
				 ISBLANK(PCard_Trans[Merchant Name])
			)
		)
		RETURN
			MAXX(
				temptable,
				[Blank count] 
			)

 

Then if you add this to the matrix and select the values that are different from you will get the expected result:Blank.gif

 

Please let me know if this works per your needs.

 

Be aware that the table visual is not based on actual columns and not on the parameters values table, because if you use the parameter table it will only return that specific column and everything will go blank.

 

If you are using this parameter table only for this specific need I suggest that you replace this by a disconnected table with the columns names making it easier to make the measure since you don't need to have the workaround for the selection of the names.

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Miguel:

 

I worked replicated you suggestion and we are so close.   Much close than I ever would have gotten. 

 

My mock up data

Trans IdTransaction DateMCCMerchant NameEmployee IdEmployee NameExpense DescriptionAmount
0000098426923782/3/20255942Book store16252Donald Duck 84.10
0000114143197716/6/20255065Electrical Parts97427Micky Mouseextension cord-71.38
0000094524796828/8/20255251Local Hardware Store930758SupermanKEYS146.08
00001136107600511/11/20255251Local Hardware Store95464BatmanCaulking449.90
00001138710033110/10/20255251Local Hardware Store  Hammer163.85
00001140925248712/12/20255251Local Hardware Store97678Green HornetDrill Bit111.82
0000114768943431/10/2026 Local Hardware Store096284Poison Ivy1"pip-26.58
0000097471455961/12/20265251Local Hardware Store **bleep** Tracy 118.63
000011569009247  Local Hardware Store94474Wonder WomanAdjustable Wrench185.18
0000116929056693/10/20265251Local Hardware Store11066Under Dog 144.84
0000118729136853/17/20265039Plumbing Supply  PUMP PARTS62.99
0000118788342814/4/20255039Plumbing Supply930276Spider ManPUMP PARTS37.56
000011878834277 5039Plumbing Supply95455The Flash 12.57
0000100787086425/5/20255039Plumbing Supply The FlashMISC PLUMBING SUPPLIES79.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 

image.png

 

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.

 

image.png

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

image.png

 

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 

image.png

 

this is beyond me.

 

Many thanks for your attention to this matter.

Believe we are close.

 

KBD

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:

 

MFelix_0-1778696240167.png

MFelix_2-1778696289434.png

 

MFelix_1-1778696254203.png

 

 

Concerning the first row on your example I was not able to replicate it but seems to be working fine on my side.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Miguel:

 

You are the man.

That worked.

 

Many thanks

 

KBD

Hi @KBD ,

 

Thank you for you kind words, don't forget to accept the correct answer so it can help others even if it is your own answer.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





v-agajavelly
Community Support
Community Support

Hi @KBD

Thanks  for @MFelix , @cengizhanarslan  & @danextian  the detailed solution and explanation here really helpful.


@KBD Just checking in were you able to try the suggested approach and does it resolve your scenario?

If you're still seeing any mismatch or the filter isn’t behaving as expected, feel free to share a quick example and we can help you fine-tune it further.

Thanks,
Akhil.

was traveling for a week.

following up on this now

 

KBD

danextian
Super User
Super User

Hi @KBD 

You cannot reference a field parameter table row directly. What you can do is write a conditional measure that references the field order. For example:

SWITCH (
    SELECTEDVALUE ( FieldParameter[Order] ),
    0, [Measure A],
    1, [Measure B],
    3, [Measure C]
)




Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
cengizhanarslan
Super User
Super User

Please try the measure below:

Has Missing Detail =
VAR _Selected =
    SELECTEDVALUE ( missingDetails[missingDetails Fields] )
RETURN
    SWITCH (
        _Selected,
        "ACCOUNT NAME",
            IF ( ISBLANK ( MAX ( PCard_Trans[ACCOUNT NAME] ) ),       1, BLANK () ),
        "EMPLOYEE ID",
            IF ( ISBLANK ( MAX ( PCard_Trans[EMPLOYEE ID] ) ),        1, BLANK () ),
        "MERCHANT NAME",
            IF ( ISBLANK ( MAX ( PCard_Trans[MERCHANT NAME] ) ),      1, BLANK () ),
        "TRANSACTION DATE",
            IF ( ISBLANK ( MAX ( PCard_Trans[TRANSACTION DATE] ) ),   1, BLANK () ),
        "MCC",
            IF ( ISBLANK ( MAX ( PCard_Trans[MCC] ) ),                1, BLANK () ),
        "EXPENSE DESCRIPTION",
            IF ( ISBLANK ( MAX ( PCard_Trans[EXPENSE DESCRIPTION] ) ), 1, BLANK () ),
        1
    )

 

Add this measure to Filters on this visual on your transaction table and set it to is 1.

_________________________________________________________
If this helped, ✓ Mark as Solution | Kudos appreciated
Connect on LinkedIn | Follow on Medium
AI-assisted tools are used solely for wording support. All conclusions are independently reviewed.

I have been rude.   Forgot to thank you for your suggestion.

Thanks 

But do not believe it works.  

Please refer to other comments

 

KBD

If I do the following:showIfEmptyfixed = VAR __SelectedValue = SELECTEDVALUE( missingDetails[missingDetails Fields] ) RETURN SWITCH( __SelectedValue , "'PCard_Trans'[ACCOUNT NAME]", "ACCOUNT NAME" , "'PCard_Trans'[EMPLOYEE ID]", "EMPLOYEE ID" , "'PCard_Trans'[MERCHANT NAME]", "MERCHANT NAME" , "'PCard_Trans'[TRANSACTION DATE]", "TRANSACTION DATE", "'PCard_Trans'[MCC]", "MCC", "'PCard_Trans'[EXPENSE DESCRIPTION]", "EXPENSE DESCRIPTION", "None Selected" ) 

I can get back the field I selected in my slicer.  Notice the field name must be fully specified  Ie.   "'PCard_Trans'[ACCOUNT NAME]"

I see the corresponding text in my table.

This tells me:

SELECTEDVALUE(
              missingDetails[missingDetails Fields]
is returning the expected value.
 
If I use:
 
showIfEmptyfixed = VAR __SelectedValue =
    SELECTEDVALUE( 
              missingDetails[missingDetails Fields]
    )
  RETURN   
SWITCH( __SelectedValue ,    
     "'PCard_Trans'[ACCOUNT NAME]",          SELECTEDVALUE( 'PCard_Trans'[ACCOUNT NAME] ) ,
     "'PCard_Trans'[EMPLOYEE ID]",           SELECTEDVALUE('PCard_Trans'[EMPLOYEE ID]  )   ,
     "'PCard_Trans'[MERCHANT NAME]",         SELECTEDVALUE('PCard_Trans'[MERCHANT NAME]  ) ,     
     "'PCard_Trans'[TRANSACTION DATE]",      SELECTEDVALUE( 'PCard_Trans'[TRANSACTION DATE]  ),
     "'PCard_Trans'[MCC]",                   SELECTEDVALUE( 'PCard_Trans'[MCC]  )    ,
     "'PCard_Trans'[EXPENSE DESCRIPTION]",  SELECTEDVALUE(  'PCard_Trans'[EXPENSE DESCRIPTION] ),
    "None Selected"  
  
  )I get values , but only on certain rows.    

do not see the pattern as to how the values are returned.

 

Following your suggestion I did the following:

 

showIfEmptyfixed = VAR __SelectedValue = SELECTEDVALUE( missingDetails[missingDetails Fields] ) RETURN SWITCH( __SelectedValue , "'PCard_Trans'[ACCOUNT NAME]", IF ( ISBLANK ( MAX( 'PCard_Trans'[ACCOUNT NAME] ) ) , 1, BLANK () ), "'PCard_Trans'[EMPLOYEE ID]", IF ( ISBLANK ( MAX('PCard_Trans'[EMPLOYEE ID] ) ) , 1, BLANK () ), "'PCard_Trans'[MERCHANT NAME]", IF ( ISBLANK ( MAX('PCard_Trans'[MERCHANT NAME] ) ) , 1, BLANK () ), "'PCard_Trans'[TRANSACTION DATE]", IF ( ISBLANK ( MAX( 'PCard_Trans'[TRANSACTION DATE] ) ), 1, BLANK () ), "'PCard_Trans'[MCC]", IF ( ISBLANK ( MAX( 'PCard_Trans'[MCC] ) ) , 1, BLANK () ), "'PCard_Trans'[EXPENSE DESCRIPTION]", IF ( ISBLANK ( MAX( 'PCard_Trans'[EXPENSE DESCRIPTION] ) ), 1, BLANK () ), "None Selected"

 

This returns  1 in the opposite pattern from the prior  measure code.

So no progress here.

I believe the Max and SelectedValue look at the whole table and not row by row.   Can anyone provide feed back on that.

 

 

 

 

created a measure as follows:

showIfEmptyfixed = VAR __SelectedValue =
    SELECTEDVALUE( 
              missingDetails[missingDetails Fields]
    )
  RETURN   
SWITCH( __SelectedValue ,    
     "ACCOUNT NAME",      IF ( ISBLANK ( MAX ( PCard_Trans[ACCOUNT NAME] ) ),       1, BLANK () ),
     "EMPLOYEE ID",       IF ( ISBLANK ( MAX ( PCard_Trans[EMPLOYEE ID] ) ),        1, BLANK () ),
     "MERCHANT NAME",     IF ( ISBLANK ( MAX ( PCard_Trans[MERCHANT NAME] ) ),      1, BLANK () ),
     "TRANSACTION DATE", IF ( ISBLANK ( MAX ( PCard_Trans[TRANSACTION DATE] ) ),   1, BLANK () ),
     "MCC",              IF ( ISBLANK ( MAX ( PCard_Trans[MCC] ) ),                1, BLANK () ),
     "EXPENSE DESCRIPTION", IF ( ISBLANK ( MAX ( PCard_Trans[EXPENSE DESCRIPTION] ) ), 1, BLANK () ),
    1   
  
  ) 

 

added showIfEmptyfixed  to the table   each row comes back as 1 (one)

so no progress   believe MAX looks at the whole table , so this will never work

 

KBD

Added 

KBD
Helper III
Helper III

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

MFelix
Super User
Super User

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/


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





KBD
Helper III
Helper III

did not put my code snippets in code boxes because the site kept saying that invalide HTML was generated😯

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.