Qlik Community

Ask a Question

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Qlik Highlights 2020 Giveaway! Watch, reply and have a chance to win a $200 Amazon Gift Card! Watch Video
cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor

Showing Data for every 2 Weeks instead of Daily (I do not want aggregated data)

Hi Qlikview Experts,

 

I am fairly new to Qlikview. Currently my chart is shown as below:
a.PNG

I want data points on the X - Axis to show a data point for every 2 weeks. So essentially the first data point would be:

1. '02 Jan',

2. next would be '17- Jan'

3. Next would be '31 - Jan' and so on

I only want to show the points for every 2 weeks, but the y valaues remains unchanged (I tried using weekname, week functions in a calculated dimensions) but it will aggregate the values on the y axis).

I was thinking that maybe I could use a function to concatenate date values + a static step. How would I go about by doing this. Thanks!

4 Replies

This is doable in Qlikview. Can you please share some sample application for solution.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

Just to clarify, do you want to reduce the number of date values shown on your dimension axis while keeping the lines unchanged or do you also want to reduce the number of points your lines consist of?

You might use a calculated dimension to get your expected result.
However switching to continuous dimension axis might as well be a solution (though not being restricted to biweekly dates) as you seem to have missing date values that might distort your lines.

Please post some sample data and your expected result to demonstrate solutions with

thanks

regards

Marco
Partner
Partner

Try the following example code:

Script to generate sample Values:

Values:
Load
Rand()*1000 as Value,
date(num(addyears(Today(),-1))+RecNo( )) as Date
AutoGenerate 365;

Create a Chart with "Date" as dimension and the expression:

sum({<Value={"=Date=weekstart(Date)"}>*<Value={"=-1=odd(week(Date))"}>} Value)

The expression will only sum Value when Date is the first date of a week AND (since we use star (*) between sets (<>)) when the week is odd() (could be changed to the function even() if needed). If there is only one Value per date you may use the only() function instead of sum() in your expression.

Note that Value in the set expression could be any field, except Date, its basically just an if statement. Google "Les set analysis_ENG.pdf" for details on how to use conditional statements in set analysis.

Partner
Partner

Try the following expression in a chart with Date as dimension:

sum({<Value={"=Date=weekstart(Date)"}>*<Value={"=-1=odd(week(Date))"}>} Value)

We use boolean statements ({<Dimension = {"=boolean condition"}>}) in the two sets and then take the intersection (*) between them. Note that the fields in the conditions cannot be the same as the Dimension field. sum() could be changed to only(), likewise odd() could be changed to even() if required.

You can use this script to generate test data for the expression above:

Load
Rand()*1000 as Value,
date(num(addyears(Today(),-1))+RecNo( )) as Date
AutoGenerate 365;