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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Firstnonblank is not working right

Hi everyone.

 

The structure I have is pretty complex and maybe that's the reason why the formula doesn't work right.

 

So, I have a calculated table 'Customers calc'. It is mainly based on NATURALLEFTOUTERJOIN(customers,subscriptions). This table has a service_code column by which I'm trying to get a case_study_link from another table. Since one service_code can have multiple case_study_links, I'm using FIRSTNONBLANK.

 

The calculated column is the following:


Case study = 

CALCULATE (
FIRSTNONBLANK( case_studies[case_study_link], 1 ),
FILTER ( ALL ( case_studies ), case_studies[service_code] = 'Customers calc'[service_code] ))
 
And it does return a right case_study_link in 32 cases, while I have more than 100 values. So in some cases, it returns blank instead of the value, while in others it works fine. I don't see any regularity here...
 
I'm attaching a screenshot of the model with the abovementioned tables.

I would appreciate any help.
 
model.png
3 REPLIES 3
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous

 

Could you provide pbix file after removing sensitive information?

Sample data and expected output would help tremendously.
Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Best Regards,

Link

amitchandak
Super User
Super User

@Anonymous , Try a formula like this

 

MINX(FILTER ( case_studies, case_studies[service_code] = 'Customers calc'[service_code] ), case_studies[case_study_link])

Anonymous
Not applicable

Hi @amitchandak 

With this formula, I get 66 values which is better than before. But some values are still missing. For example, I noticed that it returns blank instead of a value when there are 3 values in the case_studies table for a service code.

Helpful resources

Announcements
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.