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: 
Vittore8
Creator
Creator

Ggroup by month use Set Analysis

Vittore8_1-1588763269404.png

 

Hi, please tell me how I can group by month I use set analysis? And display


01.2017
01.2018
02.2017
02.2018

=if(year([Date]) = 2018, [Date]) -- so far I write like this, but it is not correct

 

Labels (1)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

I don't think that SET analysis will solve your issue, but you can obtain what you want by using a calculated dimension like this:

=Date(MonthName(Date),'MM.YYYY')

Screenshot from QlikView, but it will behave similarly in Qlik SenseScreenshot from QlikView, but it will behave similarly in Qlik Sense

 

View solution in original post

8 Replies
eliran
Creator III
Creator III

Hi,

If you need it in the expression, and you don't use month/year fields or a calendar, the easiest way to do is like this:

sum(if(Year(Date)=2018,<Field>))

You can use more advanced ways with set analysis, but the above is the basic.

Regards,

Eliran.

Vittore8
Creator
Creator
Author

I use this as dimension, I want to display -- month.year , not day.month.year

Taoufiq_Zarra

if i understood correctly

in dimension Add Calculated Dimension.. -> Month(_DATEFIELD)&'.'&Year(_DATEFIELD)-> and Supress when valued is null

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Vegar
MVP
MVP

I don't think that SET analysis will solve your issue, but you can obtain what you want by using a calculated dimension like this:

=Date(MonthName(Date),'MM.YYYY')

Screenshot from QlikView, but it will behave similarly in Qlik SenseScreenshot from QlikView, but it will behave similarly in Qlik Sense

 

Vittore8
Creator
Creator
Author

=Date(MonthName(if(year([Date])=2018, [Date])),'MM.YYYY') -- Thanks! I added if and got the desired result!

tresesco
MVP
MVP

Or, simply:

=Date(Date, 'MM.YYYY')

There is no point using one formatting function inside another.

Vegar
MVP
MVP

@tresesco  There is a quite crucial differene between MonthName() and Date(). MonthName() is not only a formatting function as Date() is. MonthName is also of a transform/convertion function.

MonthName() converts the date (or timestamp) into the first day of the month and both the dual text and numeric value will change.

Date(field, 'MM.YYYY') formats the dual text into the desired format (here MM.YYYY), but the underlying numeric value will not change. So when only using =Date(Date,'MM.YYYY') you will get multiple unique fieldvalues with identical text representation. See my attached image below.

Vegar_0-1588768527985.png

In my earlier example I used the outer date() just to format the presentation as the post author wanted. I could just have used monthname(Date), but then the presentation would have been  the default MMM YYYY.

Vegar_0-1588768835823.png

 

BR
Vegar

tresesco
MVP
MVP

Hi @Vegar ,

I always had this problem of not remembering which are formatting and which are transforming (value changing) functions in qlik date, time function list. Before posting I quickly checked the help and read:

Untitled1.png

 

and just didn't complete reading it:

 

Untitled.png 

 

😋