Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

morenoju
Contributor II

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
Contributor III

Re: Chart with three columns

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,

9 Replies
felipedl
Valued Contributor III

Re: Chart with three columns

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

Re: Chart with three columns

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
Valued Contributor III

Re: Chart with three columns

Juan,

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

Sample.png

Felipe.

morenoju
Contributor II

Re: Chart with three columns

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
Valued Contributor III

Re: Chart with three columns

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
Contributor III

Re: Chart with three columns

Hi,

You expecting like this,

Testiss.JPG

Regards,

morenoju
Contributor II

Re: Chart with three columns

Hi,

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

Regards.

pathiqvd
Contributor III

Re: Chart with three columns

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

Re: Chart with three columns

Works great. Thank you!