en
Welcome Guest! To enable all features please Login or Register.
Options
Go to last post Go to first unread
Karol  
#1 Posted : Friday, October 7, 2016 9:42:21 AM(UTC)
Karol
Rank: Advanced Member

Groups: extranet\Forum
Joined: 5/6/2016(UTC)
Posts: 12

Hi,
I have another question regarding analysis in Targit.
How can I handle "undefined" value in calculation fields?

I have a simple table with the Site ID and number of records per site.
Let's assume that we have 3 different sites but only two of them have records related:

UserPostedImage

Calculated fields:
- Total Visible: allcount(0, all(v), 0, 0)
- Total Count: allcount(0, all, 0, 0)
- %: allcount(0, all(v), 0, 0) / allcount(0, all, 0, 0)

When I select the site which has rows I get the proper result.

UserPostedImage

But when I select Pickering (which has no rows) I will get 'Undefined' value.

UserPostedImage

Is there any way to handle this exception(I want to get 0 instead of 'Undefined')?
Maybe something like isnull() function in TSQL? Or maybe there is a way to handle this with If There Else statement?
Somewhere on the forum I found information that the 4th parameter in e.g. allcount(0, all, 0, 0) should solve the problem, but unfortunately it doesn't.

Thanks
Anmol Sunsoa  
#2 Posted : Monday, October 17, 2016 6:49:19 PM(UTC)
Anmol Sunsoa
Rank: Advanced Member

Groups: extranet\Forum
Joined: 5/5/2016(UTC)
Posts: 13

Hello Karol,

I have experienced this and the best way is to check both values in the calculation like
if sum(d-1,0,m1)=0 Then 0 else sum(d-1,0,m1)/sum(d-2,0,m1).

Kind Regards

Anmol Sunsoa
Users browsing this topic
Anonymous
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error