Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlikview Experts,
I am fairly new to Qlikview. Currently my chart is shown as below:
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!
This is doable in Qlikview. Can you please share some sample application for solution.
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.
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;