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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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