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
Anonymous
Not applicable

Create a measure to return a certain value when it matches a condition

Hi all,

 

I wanted to create a measure to return the "Wait Time" value when the Store ID = National.

 

The table called ("Performance_Latest") is like:

Store ID       Wait Time

111              80%

222              90%

National      88%

 

The formula i used is:

WaitTime_National = CALCULATE(AVERAGE(Performance_Latest[Wait Time]), Performance_Latest[Store ID]="National")
 
but it didn't work and it returned blank.
 
Do you know how to fix it?
 
Thank you so much!
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , I doubt some other filter is there.

Check if this gives data. It means some other filter is there

WaitTime_National = CALCULATE(AVERAGE(Performance_Latest[Wait Time]),filter(all(Performance_Latest), Performance_Latest[Store ID]="National"))

View solution in original post

4 REPLIES 4
sebastiangestia
Resolver I
Resolver I

Hello @Wenlu_Zhang,

I get the part - "National"... What do you mean?

That may be affecting, as it is a text applied to the ID for the CALCULATE.

Best regards!

AllisonKennedy
Super User
Super User

Do you have any other filters applied that could cause it to return blank?

What is the data type for Wait Time column?

Is National spelled EXACTLY the same in the table as it is in your measure?

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

You measure should work

 

Try this

 

WaitTime_National = CALCULATE(SUM(Performance_Latest[Wait Time]), Performance_Latest[Store ID]="National")

 

else are there any filters

 

Regards,

Harsh Nathani

amitchandak
Super User
Super User

@Anonymous , I doubt some other filter is there.

Check if this gives data. It means some other filter is there

WaitTime_National = CALCULATE(AVERAGE(Performance_Latest[Wait Time]),filter(all(Performance_Latest), Performance_Latest[Store ID]="National"))

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.