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

Weird behavior in the division operation

All,

I have a calculation like this:

(Both Numerator and Denominator work individually... but their division doesn't work)

Sum(Aggr(if(Sum([Is Engaged?])/(Count(distinct [Month Year])*4) >= 2,1,0) , [Party ID]))

/

Sum(Aggr(1,[Party ID])) // same as Count (distinct [Party ID])



What I have tried:


Put numerator and denominator separately in a variable and do the division on variables. Doesn't work


Use the div function.


Hoping I didn't do any silly mistake


stalwar1

9 Replies
sunny_talwar

Don't see anything wrong here... are you using these in a variable and then doing the division through a variable?

vkish16161
Creator III
Creator III
Author

Hey Sunny,

I tried that as well. Do you think this could be a bug? Weird thing is that the numerator and denominator work well individually in KPI boxes.

Also I've noticed that....

Sum(Aggr(1, [Party ID]))  is yielding 1 more than Count(distinct [Party ID])


for e.g...


Sum(Aggr(1, [Party ID]))    =101


Count(distinct [Party ID])  =100

Shouldn't both be the same?

stalwar1

sunny_talwar

I would have thought that the two give the same number... not sure but may be there is a null Party ID, which is getting counted when using Sum(Aggr())...

Coming back to your division... would you be able to share a sample to check out?

vkish16161
Creator III
Creator III
Author

"I would have thought that the two give the same number... not sure but may be there is a null Party ID, which is getting counted when using Sum(Aggr())..."


How can I exclude nulls in the Aggr? Sum({<[Party ID] - = {"*"}>} Aggr(1, [Party ID]))


Will provide sample data soon.


stalwar1

sunny_talwar

May be this

Sum({<[Party ID] = {"*"}>} Aggr(1, [Party ID]))

vkish16161
Creator III
Creator III
Author

Thanks bro. Will check it out.

vkish16161
Creator III
Creator III
Author

lol. Things got weirder... The following nonsensical tweak made it work.

Variables:

numer  =  (Sum(Aggr(if(Sum([Is Engaged?])/(Count(distinct [Month Year])*4) >= 2,1,0) , [Party ID])) *2 )

/

denom =  ( Count (distinct [Party ID]) * 2)



Expression:


$(numer) / $(denom)


Suspect:  [Is Engaged?] is of Dual type. (Used dual function here)



stalwar1


sunny_talwar

Difficult to say without looking at this...

sasiparupudi1
Master III
Master III

Try with a bracket in the numerator

(

Sum(Aggr(if(Sum([Is Engaged?])/(Count(distinct [Month Year])*4) >= 2,1,0) , [Party ID]))

)

/

Sum(Aggr(1,[Party ID]))