Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
edouard_chandav
Contributor II
Contributor II

Min or Max of a calculated expression

Hello,

I have been struggling too long so I ask for your kind help.

My goal is to fill in a variable with the max of the following expression. I need to get a single value at the end.

I have a table with 2 columns

dimension: it'a cyclical group with the first dimension equal to Jour=Date(date_occ-(year(date_occ)-v_AnneeRef)*364,'DD/MM/YY')

It is used to compare equivalent day between different years. A monday with a monday A tuesday with a tuesday etc

So I have several date_occ already aggregated under each "jour"

Expressions:

Demande: =($(vExpr_nombrededemandes))/count(DISTINCT{$< statut_option= , statut_affaire={"*"}> } ANNEE_OCCUPATION)

vExpr_nombrededemandes= (Count({$< libel_segment={"*"}-{'Salles expos/orgas'}-{'Autres'}, statut_option= , statut_affaire={"*"}-{'IMMOBIL'}>}  DISTINCT mot_directeur) )


DATA.PNG

Thanks a lot

1 Solution

Accepted Solutions
26 Replies
sunny_talwar

It might be easier to help if you are able to share a sample to play around with.

edouard_chandav
Contributor II
Contributor II
Author

Hello

I attached a sample the goal is still to display the max of the calculated field 'average demand'

thanks

Edouard

sunny_talwar

This seems to work for the sample... but not sure if it still works for the real scenario or not

=Max(Aggr(($(vExpr_nombrededemandes))/(count(DISTINCT{$< statut_option= , statut_affaire={"*"}> } ANNEE_OCCUPATION)), date_occ))

edouard_chandav
Contributor II
Contributor II
Author

Hello

Thanks for this first answer.

I get 10 when I use this formula which is the max of demand. I am looking for the max of "average number of demand"  in the TABLE 1

Thank you so much

sunny_talwar

And there is no way you can calculate your calculated dimension in the script?

edouard_chandav
Contributor II
Contributor II
Author

No,

Because the hierarchical group uses a variable v_AnnéeRef.

Is there still a way or it is just not possible?

sunny_talwar

I will keep looking for a little bit, but I don't think there is a way to do this.

sunny_talwar

I don't think I know a way to do this... but may be swuehl‌ or marcowedel‌ can offer there expert advice.

Best,

Sunny

edouard_chandav
Contributor II
Contributor II
Author

Maybe with a firstsortedvalue? But I don't master this formula