Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
CodeKazuko
Contributor III
Contributor III

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
MVP
MVP

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

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

Or
MVP
MVP

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.