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: 
morenoju
Partner - Specialist
Partner - Specialist

Chart with three columns

Hi all,

I'm creating a very simple chart, just three columns one after another.

I have the three expressions corresponding to the values I want to represent and if I place them as Measures, it works: they are displayed as three columns.

Count({<StartDate={"=InWeek(StartDate, Today(), 0)"}>}EventCode)

Count({<StartDate={"=InWeek(StartDate, Today(), -1)"}>}EventCode)

Count({<Year={$(=vTodayYear-1)}, Week={$(=vTodayWeek)}>}EventCode)

I'd like to name them Current Week, Last Week, Same Week Last Year. What do I have to create as a Dimension for this?

Thanks!

Juan

1 Solution

Accepted Solutions
pathiqvd
Creator III
Creator III

Hi,

Dim:- =ValueList('Current week','Last week','Same Week Last Year')

Expr:-

=if(ValueList('Current week','Last week','Same Week Last Year')='Current week',

Count({<StartDate={"=InWeek(StartDate, Today(), 0)"}>}EventCode),

if(ValueList('Current week','Last week','Same Week Last Year')='Last week',

Count({<StartDate={"=InWeek(StartDate, Today(), -1)"}>}EventCode),

if(ValueList('Current week','Last week','Same Week Last Year')='Same Week Last Year',

Count({<Year={$(=vTodayYear-1)}, Week={$(=vTodayWeek)}>}EventCode))))

Regards,

View solution in original post

9 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

Hi Juan,


Bellow the expressions, you have the "Label" box in which you can put your "Current Week", "Last Week" and "Same Week Last Year" text (mine is in portuguese, but it's this field).Sample.png

Felipe.

morenoju
Partner - Specialist
Partner - Specialist
Author

Hi Felipe, I already did that, but it does not get displayed. Take into account I'm using a bar chart, not a table. That's why I have to define a dimension, but I'm not sure of what to configure there.

felipedl
Partner - Specialist III
Partner - Specialist III

Juan,

They go as axis on the barchart and graph legends as demonstrated bellow.

Sample.png

Felipe.

morenoju
Partner - Specialist
Partner - Specialist
Author

But Felipe, how did you get "Bangalore, Hyderabad... etc".? Is it related to the dimension you're using? What dimension is it, by the way?

felipedl
Partner - Specialist III
Partner - Specialist III

It's just some sample data, it's a dimension as any other, and can be changed. (I was anwsering another post here and used the same app with this data).

With the following code:

Calendar:

Load

Month(InicialDate) & '-' & Year(InicialDate) as [Year/Month],

    InicialDate;

LOAD

date(AddMonths(Today(),-12)+recno()) as InicialDate

AUTOGENERATE Today()-AddMonths(Today(),-12);

I generate all the dates between today and 12 months back (for better example) and put [Year/Month] as the barchart dimension, giving

Sample.png

I attached the file I created here, just copy it to C:\Users\<user name>\Documents\Qlik\Sense\Apps and you'll see it in Qlik Sense hub.

pathiqvd
Creator III
Creator III

Hi,

You expecting like this,

Testiss.JPG

Regards,

morenoju
Partner - Specialist
Partner - Specialist
Author

Hi,

That's exactly what I'm trying to get.

Regards.

pathiqvd
Creator III
Creator III

Hi,

Dim:- =ValueList('Current week','Last week','Same Week Last Year')

Expr:-

=if(ValueList('Current week','Last week','Same Week Last Year')='Current week',

Count({<StartDate={"=InWeek(StartDate, Today(), 0)"}>}EventCode),

if(ValueList('Current week','Last week','Same Week Last Year')='Last week',

Count({<StartDate={"=InWeek(StartDate, Today(), -1)"}>}EventCode),

if(ValueList('Current week','Last week','Same Week Last Year')='Same Week Last Year',

Count({<Year={$(=vTodayYear-1)}, Week={$(=vTodayWeek)}>}EventCode))))

Regards,

morenoju
Partner - Specialist
Partner - Specialist
Author

Works great. Thank you!