# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Valued Contributor

## Perform a mathematical division with Set Analisys

Hello,

I´ve trying to divide (a+b)/(c+d) into set analysys within other if sentences, All if works fin (all are sum) but division gives 0,

I add a qlikview example ...

Thank you!

1 Solution

Accepted Solutions
MVP

## Re: Perform a mathematical division with Set Analisys

Well, this returns 1830:

=Sum({<Factor = {'Total Cantidad','Total Valor','Total CP','Dotacion Total'}>}

If(Factor = 'Total Cantidad',Hrs.Ord.ppto+Hrs.Ext.ppto,If(Factor = 'Total Valor',[Valor_Hrs.Ext.ppto]+Valor_Hrs.Ord.ppto,

If( Factor = 'Total CP',(Valor_Hrs.Ext.ppto+Valor_Hrs.Ord.ppto)// (Hrs.Ord.ppto+Hrs.Ext.ppto)

, If(Factor = 'Dotacion Total',DotacionTotal.ppto

,0)))))

/Sum({<Factor = {'Total CP'}>}

(Hrs.Ord.ppto+Hrs.Ext.ppto)

)

4 Replies
MVP

## Re: Perform a mathematical division with Set Analisys

I think that's due to your data model.

Create a table box with the four fields involved:

Your records won't show values <>0 for both the numerator and denominator of your division at the same time, so it would result in either zero or NULL, hence the sum() would be zero.

Not sure what you are trying to achieve though. Maybe use something like Sum(a+b) / Sum(c+d) instead?

Valued Contributor

## Re: Perform a mathematical division with Set Analisys

Hi,

I need to get 1830... Thats all... If I select CP Total QlikView show me 1830 in the pivot table... If I select other filter QlikView show me good too the result, I don´t know why QlikView Doesn't the same thing in Chart Object or in a indicator?

MVP

## Re: Perform a mathematical division with Set Analisys

Well, this returns 1830:

=Sum({<Factor = {'Total Cantidad','Total Valor','Total CP','Dotacion Total'}>}

If(Factor = 'Total Cantidad',Hrs.Ord.ppto+Hrs.Ext.ppto,If(Factor = 'Total Valor',[Valor_Hrs.Ext.ppto]+Valor_Hrs.Ord.ppto,

If( Factor = 'Total CP',(Valor_Hrs.Ext.ppto+Valor_Hrs.Ord.ppto)// (Hrs.Ord.ppto+Hrs.Ext.ppto)

, If(Factor = 'Dotacion Total',DotacionTotal.ppto

,0)))))

/Sum({<Factor = {'Total CP'}>}

(Hrs.Ord.ppto+Hrs.Ext.ppto)

)

Valued Contributor

## Re: Perform a mathematical division with Set Analisys

I understand now the formula thank you swuehl