Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
CodeKazuko
Contributor II
Contributor II

Creating a single column YearMonth

I am trying to get a single column of YearMonth for Count(test). The data for Year and Month are retrieved from two dropdown, year and month. I manage to get the expression to work once but no data is generated. These are some of the code I tried to create but I think it is probably not recognised as date. When I try use makeDate, it just gives me errors about expression. 

 

if(Year=$(Year) & Month=$(Month), '$(=(vYear)&'-'&(vMonth))')

 

[TestData.autoCalendar.YearMonth] = MakeDate(vYear&'-'&vMonth) 

 

 

Labels (3)
3 Replies
Or
Champion
Champion

Insofar as the MakeDate() part, it should be something like MakeDate(vYear,vMonth) rather than the concatenated version you've tried to use. Each of the dateparts should be numeric and separated by a comma.

Generally, something along the lines of:

Count({< Year = {$(vYear)}, Month = {$(vMonth)} > } test)

May be the correct approach here.

CodeKazuko
Contributor II
Contributor II
Author

Sorry, I try the count for both year and month thing but it gives me year count instead.

Or
Champion
Champion

There's no reasonable way that using the formula suggested would give you the count of years... I'd suggest you double-check that the variable and field names are correct and contain matching values.