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: 
patricwessels
Contributor II
Contributor II

Dynamic Y-axis

I would like to set a dynamic Y-axis with the Max function. I know it works but now I can not use a field in this function (error message is " Incorrect fieldname"). Is this because it is a calculated field?

1 Solution

Accepted Solutions
chrismarlow
Specialist II
Specialist II

Hi Patric,

Yes, try aggr;

Max(aggr(sum(If([Produktbreedte]<1330,([lengte rol]-[netto lengte])*0.62,([lengte rol]-[netto lengte])*1.24)), dimension ))


I've tried to bold the bits to insert, dimension would be the dimension your chart uses, comma separated list if more than one.


Let me know how you get on.


Regards,


Chris.

View solution in original post

4 Replies
chrismarlow
Specialist II
Specialist II

Patric,

There are definitely limitations as to where you can use the names you have given your expressions, there was a thread a couple of weeks ago on something similar, so I think your conclusion is correct.

If you copy in the original expression will that work? You may need to wrap an aggr round it (referencing the relevant dimensions) to get the right value.

Regards,

Chris.

patricwessels
Contributor II
Contributor II
Author

Chris,

Thanks for your reply.

I have defined the following: Afkeur MD = sum(If([Produktbreedte]<1330,([lengte rol]-[netto lengte])*0.62,([lengte rol]-[netto lengte])*1.24)) (sorry for the dutch words)

This results in a sum of the square meters rejected material.

The max Y-axis I want defined as the max of these square meters.

I have this: Max(sum(If([Produktbreedte]<1330,([lengte rol]-[netto lengte])*0.62,([lengte rol]-[netto lengte])*1.24)))

but that doesn't work (error in expression)

If I need aggr how do I do that? Or is something else wrong?

Regards, Patric

chrismarlow
Specialist II
Specialist II

Hi Patric,

Yes, try aggr;

Max(aggr(sum(If([Produktbreedte]<1330,([lengte rol]-[netto lengte])*0.62,([lengte rol]-[netto lengte])*1.24)), dimension ))


I've tried to bold the bits to insert, dimension would be the dimension your chart uses, comma separated list if more than one.


Let me know how you get on.


Regards,


Chris.

patricwessels
Contributor II
Contributor II
Author

Works great, thanks.

I 'forgot' the dimension in the aggr function,

Regards, Patric