Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Read about the latest Qlik Community enhancements on the Community News blog!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Synchronize Date Axes on Two Separate Graphs

Hi All,

I have two graphs.  One represents sales.  The other represents inventory.  I have these fields mapped to a canonical date such that they can be referred to on the same graph.  Our business customer desires to have two separate graphs as we can show more information this way.

Sometimes there are sales or arrivals that occur beyond the latest date of the other field, ie one graph goes to 4/25/16 and the other to only 4/18/16.

I'm looking for a way to limit the X-axis (date) such that it only shows the smaller of the two (Largest available date).  I've tried to do this in the expression but I think it's only capturing one date.  I need to to be all dates up until the largest shared date.

Is there any easy way to do this?  I've attempted it for a good couple of hours and can't seem to crack it.

Thanks for your help!

-Keithz

1 Solution

Accepted Solutions
swuehl
MVP
MVP

There might be different solutions.

For example, for charts with an axis tab you can set the max x axis on both charts to something like

=RangeMin( Max({<InventoryQty = {"*"}>} Date),Max({<SalesAmount = {"*"}>} Date) )


Or create a variable from above and use this as threshold in either calculated dimensions or set expressions to limit the scope of aggregation  in both charts.

View solution in original post

5 Replies
swuehl
MVP
MVP

There might be different solutions.

For example, for charts with an axis tab you can set the max x axis on both charts to something like

=RangeMin( Max({<InventoryQty = {"*"}>} Date),Max({<SalesAmount = {"*"}>} Date) )


Or create a variable from above and use this as threshold in either calculated dimensions or set expressions to limit the scope of aggregation  in both charts.

View solution in original post

Not applicable
Author

Thank you!

I tried to set variables to determine the max of Arrival Date and the max of Sale Date, and then restrict the range to the minimum of that value.  I don't think I was using the correct function.

The Range Function is what I should use to specify the dimension expression, correct?

swuehl
MVP
MVP

No, this

=RangeMin( Max({<InventoryQty = {"*"}>} Date),Max({<SalesAmount = {"*"}>} Date) )

could be used for the x-axes static max expression in both charts (assuming you are using e.g. a line chart).

In a calculated dimensin, it may look like

=If(Date <= $(=RangeMin( Max({<InventoryQty = {"*"}>} Date),Max({<SalesAmount = {"*"}>} Date) )), Date)

Not applicable
Author

Yeah the graph is a bar graph, but the X-Axis is the aforementioned Canonical Date.  I will try making this work using the dimension calculation you provided.

Thank you!

swuehl
MVP
MVP

Right, I think you can only set the static min & max x-ranges for a continouus axis, so you should go with either the calculated dimension or the set analysis approach.