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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
FOXYBARK
Helper I
Helper I

Empty measure until selection is made

Test Data File 

I hope the file can be opened from the above link. 

 

Hi. I would like to have an empty measure until a name is selected in the matrx. The measure is [Order #]. Once a customer name is selected in the matrix, I want the card to show that customer's order #. If no selection is made, show blank card. How can this be achieved?

 

Thanks, FB

1 ACCEPTED SOLUTION
pmay
Resolver I
Resolver I

Sorry, I must've been drunk.  I meant MIN or MAX, should make no difference

 

VAR _SlicerSelection = SELECTEDVALUE('Table'[Customer])

RETURN

IF (_SlicerSelection = BLANK(), "", MIN('Table'[Order #]))

 

So, the Variable will return either (BLANK) or a customer.  If it returns "(BLANK)", your first trigger condition is met, and it returns the text between the apostrophes (which is nothing), therefore showing empty.  If it returns a Customer, because you have one selected in your slicer, then it will return the minimum value in the column [Order #].  I understood your model to be that you only had one [Order #] per [Customer].

View solution in original post

9 REPLIES 9
v-rzhou-msft
Community Support
Community Support

Hi @FOXYBARK ,

 

I don't have access to your sample file from your sharing link. According to your statement, I think you want your measure [Order #] be empty until you select a [Customer Name]. Here I suggest you to use [Customer Name] from another unrelated table. If you use [Customer Name] whose data is from the same table as the data in [Order #] measure, ISFILTERED Function will not work.

My Sample:

RicoZhou_2-1659324543214.png

Customer Name = VALUES('Table'[Customer Name])

Measure:

Measure = 
IF(
ISFILTERED('Customer Name'[Customer Name]),
CALCULATE(MAX('Table'[Order]),FILTER('Table','Table'[Customer Name] in VALUES('Customer Name'[Customer Name]))),
BLANK())

Result is as below.

RicoZhou_0-1659324501612.png

RicoZhou_1-1659324509181.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you. In your measure, it is assumed that the table that has the Order # also has the Customer Name. In my data, that is not the case. My table only has an occupant_id, Order #. I tried your meaure swapping out the 'table'[customer name] for 'table'[occupant id]. It didn't work. So frustrating. 

pmay
Resolver I
Resolver I

Sorry, I must've been drunk.  I meant MIN or MAX, should make no difference

 

VAR _SlicerSelection = SELECTEDVALUE('Table'[Customer])

RETURN

IF (_SlicerSelection = BLANK(), "", MIN('Table'[Order #]))

 

So, the Variable will return either (BLANK) or a customer.  If it returns "(BLANK)", your first trigger condition is met, and it returns the text between the apostrophes (which is nothing), therefore showing empty.  If it returns a Customer, because you have one selected in your slicer, then it will return the minimum value in the column [Order #].  I understood your model to be that you only had one [Order #] per [Customer].

This was my winning measure. I have 2 different tables. One with the name and one with the order #. 

Measure 2 = var _SlicerSelc = SELECTEDVALUE('Badge by Weekname'[FNAME])
return
if( _SlicerSelc = blank(), "", MIN('FMS Assignment'[FMS Assignment]))

Thanks. Let me try that. 

pmay
Resolver I
Resolver I

How about:

 

VAR _SlicerSelection = SELECTEDVALUE('Table'[Customer])

RETURN

IF (_SlicerSelection = BLANK, "", FIRST('Table'[Order #]))

 

 

Will this work if I have my customer name in one table and order # in another table? The slicer will still be the customer name. 

Yes, as I think it should, as long as you have a relationship configured between the 2 different tables.

 

When you select a value in the slicer for Customer, the table that contains customer (let's call it customer table) is filtered in the background to contain ONLY the values in your selection.  It will also filter any tables that are in a relationship with the customer table.

Hi.

This doesn't seem to work as I don't have the 'FIRST' keyword available. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.