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

I need a bar graph that compares the day I select with the same day of the previous 5 weeks

Good afternoon

I need a graph of bars that compare the day that they select with their same day of the previous 5 weeks,

I know you can, but there is no podium to follow.

grafico barras.png

1 Solution

Accepted Solutions
Not applicable

Instead of Date field in Barchart dimension, use calculated dimension like
if(num(Date)>= $(MaxDate)-34, Date) -- and mark Suppress when value is NULL.

MaxDate is a UI Variable Max(Date).

251979.PNG

View solution in original post

5 Replies
Anil_Babu_Samineni

Can you share sample

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ahaahaaha
Partner - Master
Partner - Master

Hi Javier,

Maybe something like this (attached file)?

Dates:

LOAD

Date(Date('18.12.2016') + RecNo() - 1) as Period

autogenerate(Date(Today()) - Date('18.12.2016') + 1);

autoCalendar:

LOAD

    Date(Period) as %Date,

    WeekDay(Period) as DayWeek,

    Week(Period) as NumberWeek

Resident Dates;

Sales:

Load

Period as %Date,

Num(Period) as NumDate,

Div(Rand()*1000, 1) as Sale

Resident Dates;

DROP Table Dates;

Add variable varDate.

On a sheet of creating a new histogram.

Add Calculated Dimension:

=ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate))

Add Expression:

If (ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate)) = Date(varDate - 35), Sum({<NumDate= {$(#=varDate-35)}>} Sale),

If (ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate)) = Date(varDate - 28), Sum({<NumDate= {$(#=varDate-28)}>} Sale),

If (ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate)) = Date(varDate - 21), Sum({<NumDate= {$(#=varDate-21)}>} Sale),

If (ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate)) = Date(varDate - 14), Sum({<NumDate= {$(#=varDate-14)}>} Sale),

If (ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate)) = Date(varDate - 7), Sum({<NumDate= {$(#=varDate-7)}>} Sale),

If (ValueList(Date(varDate - 35), Date(varDate - 28), Date(varDate - 21), Date(varDate - 14), Date(varDate - 7), Date(varDate)) = Date(varDate), Sum({<NumDate= {$(#varDate)}>} Sale),

))))))

Result

2.jpg

Regards,

Andrey

Anonymous
Not applicable

Try something like this:

Script

1. Create a Year & Week in your script for YrWk

2. Create a WeekDay(yourdate) for the Week Name

Variables

* Create variables

    vMxWk = max(YrWk)

    vMnWk = min(YrWk)

    vWkName = Maxstring(WkName)

Chart

* Your dimension

    Date field

* Your expression will be:

sum({1<YrWk={'>=$(vMnWk)<=$(vMxWk)'}, WkName={'$(vWkName)'}>}Amt)

----

Please see attached for reference.

Not applicable

Instead of Date field in Barchart dimension, use calculated dimension like
if(num(Date)>= $(MaxDate)-34, Date) -- and mark Suppress when value is NULL.

MaxDate is a UI Variable Max(Date).

251979.PNG

javier1070
Contributor II
Contributor II
Author

good morning,

Effectively that is what I want to obtain, however the qvw does not respond, I follow the same steps and in my qvw does not load either