Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Assistance with expression

I need an expression to work out the value of sales within a period.

Unit price x qty

however, I want to be able to use another field (mnthin) to determine how far I look back.

if this column is 3 - I would like to go back 3 months from today and find value. if 5 then start five months back. etc.

Could anyone help please?

1 Solution

Accepted Solutions
stigchel
Partner - Master
Partner - Master

Use a set expression, something like:

{<Month='$(=Date(AddMonths(Date#(Max([order_date]),'YYYYM'),-$(=mnthin)),'MMM-YY'))'>}

Where:

-Month is an field containing the months from your date

-The -$(=mnthin) will subtract the required months

-You need to change the date formats to your own

View solution in original post

8 Replies
MK_QSL
MVP
MVP

Provide sample data please along with your requirements...

Not applicable
Author

Ill put something together and attach - thanks!

Not applicable
Author

Please see attached requirement

MK_QSL
MVP
MVP

Still not clear... Kindly provide output you want...

Not applicable
Author

Manish I have put the requirement within the document

stigchel
Partner - Master
Partner - Master

Use a set expression, something like:

{<Month='$(=Date(AddMonths(Date#(Max([order_date]),'YYYYM'),-$(=mnthin)),'MMM-YY'))'>}

Where:

-Month is an field containing the months from your date

-The -$(=mnthin) will subtract the required months

-You need to change the date formats to your own

Not applicable
Author

Thank you for your help

stigchel
Partner - Master
Partner - Master

You're welcome