Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How do I assign a month value to a field?

I have an excel document that has many columns that include in the name the month. My question is, is there a way to assign these fields to the specific month?

In example I have lists named July 2012 GP,July 2013 GP, August 2012 GP,August 2013 GP, September 2012 GP,September 2013 GP, October 2012 GP, October 2013 GP, etc... I want to have a list that lists all twelve months, and when I select a month I want a bar graph that I am working with to display the info from the lists with the corresponding names

Is there a way to do this?

Thank you

1 Solution

Accepted Solutions
Not applicable
Author

No, it would not work if January 2012 GP, February 2012 GP etc. are column names, the way I have suggested will work only if these are column values (which was my understanding earlier).

Right now I can't think of a way to extract year and month from these column names.

Yes ofcourse it can be done in the chart individually for each expression but it will not solve your purpose.

View solution in original post

15 Replies
Not applicable
Author

Hello,

Look this attached example.

Best Regards.

Not applicable
Author

Hi Joe,

Might be something like attached.

Hope this helps!

Anonymous
Not applicable
Author

It is very similar, but can this be reworked to include fields that I can put on the sheet? Thats what I am trying to really figure out, if I can apply a month to a field that has been added to the sheet.

I have recreated what you gave as an example but I am trying to figure out how to tie it to my existing data, is there any way to include this in my LOAD statement that includes the from?


Thanks for your help this far.

Not applicable
Author

TRy to concatenate an INLINE Load statement

Not applicable
Author

Not sure if I understand exactly what you mean.

But if you want to have this month calculation in your script (in your LOAD statement), then you might consider doing something like:

Temp:

Load *,

left(Date_time,3) as MMM

From .....................;

I am assuming that you have a field Date_time in the given format (January 2013 GP etc.) from your database/source file.

Once you do this in the script in your LOAD statement then you can use "Month" directly in a list box in front end.

Let me know if this is what you are looking for.

Not applicable
Author

Try This:

Set in Main Tab Script

....

SET MonthNames='Jan;Feb;Mar;Apr;....'

Temp:

Load *,

left((subfield('Date_time',' ',1)),3) as MMM

From .....................;

Anonymous
Not applicable
Author

Thats what makes this difficult, there is no date of any kind in the source, the column names is where I get the months from. I want to get as close as I can get to dynamically setting a month and a year to a column as I can get. Right now I can set up the bar graph how I want it, but I can't sort it out by month, or year.

I made an inline that looks like this:

LOAD * INLINE [

FieldName, Month, Year

July 2012 Total GP, July, 2012

July 2013 GP, July, 2013

...

];

Now other than concatenating, is there any way to link that field column to the column with the same name? In the column FieldName are names of existing fields (columns) from the spreadsheet I am using.

With this it created 3 list boxes, FieldName, Month, and Year. When I click on August in the Month List box, I want the data from all the other list boxes to be grayed out if I do not assign it August, then if I click the 2013, I only want to have the August 2012 GP list box to gray out leaving August 2013 GP to be the only "usable" data. I hope I was able to better explain what I am looking for.

Again thank you for your help.

Not applicable
Author

If you don't have a date clumn in your source data then you can pull month and Year from "FieldName" itself in the script.

PFA. Hope this is what you are looking for.

Anonymous
Not applicable
Author

That would actually be beneficial, and to do so I would assume I would have to set a delimiter of some sort to parse the names of the fields? I believe that would be the most dynamic way of assigning a month and year. So I do believe that would be what I am looking for.

Thank you