Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Folks,
i have the below expression and I want to print 0 when values is negative.
Expression : Sum({<NumDateKey={">=$(=vFromDate)<=$(=vToDate)"}>} [9LE Bulk Vol])
If above Expression gives -16.5 or 0 then show me 0 else show me actual value or 1.
I can Achieve this by using below expression. But i dont want to use If function as it will take long time to process the data in front end end. I wanted to achieve this without If condition...
If( Sum({<NumDateKey={">=$(=vFromDate)<=$(=vToDate)"}>} [9LE Bulk Vol]) <=0,0,1)
Also, I can't do it in back end also like below because it is running on dynamic date selection based on user input
If( [9LE Bulk Vol] <=0,0,1)
Suppose user Select 15-04-2018 then from_date and To_date is calculated like below . And every time user will select different date and based on that user input the expression will give the result and on that result we have to implement if negative value then 0 else 1.
From_date = (15-04-2018) -91 = 14-01-2018
To_date = 15-04-2018
So expression becomes like this
Sum({<NumDateKey={">=(14-01-2018)<=(15-04-2018)"}>} [9LE Bulk Vol])
Can anybody tell me how we can achieve whithout If condition in front end . help would be much appreciated.
Thanks
Sarfaraz
I think you should go with 'If', IF is not inside Sum, so will be executed only once after Sum calculation. It degrades performance when data volume is high, used inside SUM and executed for each row.
Hi Sarfaraz,
If you want to show actual value as it is and negative value as 0 then try
RangeMax(0,Sum({<NumDateKey={">=$(=vFromDate)<=$(=vToDate)"}>} [9LE Bulk Vol]))
If you want to show 1 for actual values and negative value as 0, this looks silly but you can try,
Fabs(Sum({<NumDateKey={">=$(=vFromDate)<=$(=vToDate)"}>} [9LE Bulk Vol])>0)
May be try like
= RangeMax(Sum({<NumDateKey={">=$(=vFromDate)<=$(=vToDate)"}>} [9LE Bulk Vol]), 0)