Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

pgalvezt
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
Highlighted
MVP
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)

)

View solution in original post

4 Replies
MVP
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:

2016-06-18 01_42_06-QlikView x64 - [C__Users_Stefan_Downloads_Test3.qvw_].png

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?

pgalvezt
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?

Highlighted
MVP
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)

)

View solution in original post

pgalvezt
Valued Contributor

Re: Perform a mathematical division with Set Analisys

I understand now the formula thank you swuehl