Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Coming your way, the Qlik Data Revolution Virtual Summit. October 27-29. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Percent Calculation using Max Function

Hi all,

I have a Straight Table which is having calculation like below:

Sum(UnitsSold)/max(Forecast).

In the above example the calculation should be 715/252 = 2.83.

The same calculation we need to capture in Single field, as we need to use this in Set expression.

The calculated field is capturing data in row level, and summing up. And showing 5.29.

But I need 2.83 should show in the last column and it should repeat for each row.

Could anyone help me do the same.

I am attaching a sample qvw.

Please help.

Thanks,

Sarif

9 Replies
Highlighted
Specialist II
Specialist II

Hi

maybe :

Sum(total UnitsSold)/max(total Forecast)    ?

if you omit "total "  that sums each line

regards

Highlighted
Specialist
Specialist

Please see the attached app.


Regards

Pratyush

Highlighted
Creator
Creator

Dear Mohammad,

Max Function use in Script - And Group by.

Use value in the front Expression.

Highlighted
MVP
MVP

Try:

=sum( total UnitsSold)/Max(total ForecastQuantity)

Highlighted
Creator II
Creator II

are you trying to say in script? or in front end.

I have a feild called[UnitsSold/ForecastQuantity].I need to use this only.

because we need to use the same field in another calculation in next chart.

Highlighted
Creator II
Creator II

I already tried the same. But result is same.

Highlighted
Creator II
Creator II

hi Pratyush,

Thanks for your reply.

Instead of creating variable, if we use max(Forecast) in denominator, then also it is working.

But i want to use the field [UnitsSold/ForecastQuantity]. As this would be using in Set expression next chart calculation.

Thanks,

Sarif

Highlighted
MVP
MVP

With the field [UnitsSold/ForecastQuantity] alone, I don't see a logic of calculating back what you are looking for. It (the possibility of solution) would be simple mathematics rather than qlik for understanding what you are trying to get.

Highlighted
Specialist
Specialist

You can probably use [UnitsSold/v_n_max_val] in your next chart.


Regards

Pratyush