Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using calculated dimension as a modifier in set expression

Hi,

I need to use a calculated dimension like monthname(datefield) as a modifier in the set expression and equate it against

monthname(AddMonths(today(),-1)) in the set expression.Please let me know how this could acheived


6 Replies
aveeeeeee7en
Specialist III
Specialist III

Hi

Try this:

Sum({<YourMonthnamefield = {"$(=monthname(addmonths(Today(),-1)))"},Year={'$(=Year(addmonths(Today(),-1)))'} >}Sales)

Regards

Aviral Nag



Anonymous
Not applicable
Author

Why not you create monthname(datefield) as MONTHNAME_DATEFIELD

at script level, NOw use this field as modifier to equate it against

monthname(AddMonths(today(),-1))

Not applicable
Author

Hi Nithin,

I understand that making it in the script would solve the issue.But, I would want to know if there is any other way to get this done

Anonymous
Not applicable
Author

No,

In set analysis, the modifier needs to be a Field name and not the calculation... or the variable....

Not applicable
Author

Hi Nithin,

so would it possible to declare the calculated dimension as a variable and use it in the set expression.I tried it but that does not seem to work

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Putting the calculation in a variable makes no difference as the variable is expanded before the set expression is evaluated. So the set expression does not see the variable, it sees the calculation, and as you already know, that does not work.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein