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

merging 3 expression into one expression

Hello all,

I am three expression say:

RollingMonth as a dimension

PreviousMonth_CurrentYear =sum({<RollingMonth={'$(=VPM)'}>} SalesAmount)

CurrentMonth_CurrentYear =sum({<RollingMonth={'$(=VCM)'}>} SalesAmount)

CurrentMonth_PreviousYear =sum({<RollingMonth={'$(=VCM)'}>} SalesAmount)


where as variable are


VPM= =MonthName(AddMonths(max(SalesDate),-1))


VCM= =MonthName(max(SalesDate))


VCMLY= MonthName(AddMonths(max(SalesDate),-12))


Can I merge these 3 expression into 1 expression by using Pick,Match,WildMatch function etc.


Regards,

Balraj


1 Solution

Accepted Solutions
sunny_talwar

See if this expression helps:

=Sum({<RollingMonth={'$(=VPM)', '$(=VCM)', '$(=VCMLY)'}, Month = , Year = >} Sales)

Output With no selection:

Capture.PNG

With Year and Month Selection:

Capture.PNG

Is this close to what you want?

View solution in original post

27 Replies
Anonymous
Not applicable
Author

Take this as:


CurrentMonth_PreviousYear =sum({<RollingMonth={'$(=VCMLY)'}>} SalesAmount)

sunny_talwar

Sure you can, but what will decide which expression to show? A list box?

kavita25
Partner - Specialist
Partner - Specialist

You can make flags in back end and used in front end...

Anonymous
Not applicable
Author

I need to show all the expression on the base of current selection.

Say, If I have selected Jan 2015, then it shoud show me

Jan 2015,

Dec 2014,

Jan 2014

sales.....

sunny_talwar

Can you try this (Not sure if this will work, but no harm in trying )

=Sum({<RollingMonth={'$(=VPM)', '$(=VCM)', '$(=VCMLY)'}>} SalesAmount)

Anonymous
Not applicable
Author

How I can create Flag at backend for all these..

Say I am having Transaction_ Date..

On what basis I can create a flag??

Anonymous
Not applicable
Author

Not working

sunny_talwar

Check if this is what you want:

Capture.PNG

kavita25
Partner - Specialist
Partner - Specialist

Flags will be static...

You want dynamic on the basis of selection..so you can make variables and used it on your expression.

You want one expression to be calculated for all the three logic ???

then,

Hope the below expression will help you..

=sum({<RollingMonth={'$(VCMLY)','$(VCM)','$(VPM)'}>}Sales)