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

IF(ISBLANK) gives different results depending on the year filter

Hey, guys, 

 

I have a problem with ISBLANK. I am usinng it in formula like this:

Už depozitoriumo paslaugas = IF(ISBLANK(
CALCULATE(SUM('GL Entries'[G_LEntries.Amount]), Mapping[Mapping II] = "Depozitoriumui")), 0)
 
But for some reason, it works well when I filter one year, but does not work for another:
almafater2_0-1623847420059.png

What is going on here? 

 

I am attaching a link to an example file: https://www.dropbox.com/s/vwt3r1xf6ak2fp5/Example2.pbix?dl=0

Thankfull for any help. 



1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

You are missing the ELSE option in your IF() expression and if you do not specify this the default behaviour is to return a blank value.

 

So the logic basically says "IF the calculation is blank return 0 else return blank"

 

You could fix this by repeating your calculate expression, but I would fix this by capturing the result of that expression in a variable and then return that value.

 

eg

 

Už auditą =
var _amount = CALCULATE(SUM('GL Entries'[G_LEntries.Amount]), Mapping[Mapping II] = "Už auditą")
return IF(ISBLANK(_amount), 0, _amount)

View solution in original post

1 REPLY 1
d_gosbell
Super User
Super User

You are missing the ELSE option in your IF() expression and if you do not specify this the default behaviour is to return a blank value.

 

So the logic basically says "IF the calculation is blank return 0 else return blank"

 

You could fix this by repeating your calculate expression, but I would fix this by capturing the result of that expression in a variable and then return that value.

 

eg

 

Už auditą =
var _amount = CALCULATE(SUM('GL Entries'[G_LEntries.Amount]), Mapping[Mapping II] = "Už auditą")
return IF(ISBLANK(_amount), 0, _amount)

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.