Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
pgalvezt
Specialist
Specialist

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
swuehl
MVP
MVP

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
swuehl
MVP
MVP

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
Specialist
Specialist
Author

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?

swuehl
MVP
MVP

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)

)

pgalvezt
Specialist
Specialist
Author

I understand now the formula thank you swuehl