
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Optimized way to write if(expression=0,Null(), expresssion)
Hi,
I'm trying to find an optimized way to write an expression. The current requirement is
if(expression=0,Null(), expresssion)
But I believe if the expression is too heavy(in many case), it may be time and resource consuming when several expressions like this will be together in a straight table. I want to reduce the calculation time.
There is an inbuilt function i.e. Alt but it does opposite of what I need.
Hence, I'm here for help. Thank you.
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe what you're using is already the best way to go about it, assuming having a null value is required. I would suggest reconsidering whether a null() is required rather than a 0 in the first place, and I'd also suggest investigating your data model and setup if a basic sum with a set creates a performance issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@AnasAbbasi94 Hello, what is the expresssion conditon looks like?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
expression is simple and has few filters in set analysis.
example: I have expressions stored in variable
eTotalSalesCY= sum({<Year={'2023'}, Dept={'IT'}>}Sales)
I think when I write eTotalSalesCY in the expression like
if(eTotalSalesCY =0,Null(), eTotalSalesCY ), it will evaluate eTotalSalesCY twice, I may be wrong but I'm trying to find the most optimized way to write this.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe what you're using is already the best way to go about it, assuming having a null value is required. I would suggest reconsidering whether a null() is required rather than a 0 in the first place, and I'd also suggest investigating your data model and setup if a basic sum with a set creates a performance issue.
