Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
When i used Max(DATE) it will return me the Max Date according to the dimension, but when i used =$(=MAX(DATE)). its return me all 16 value which is max over through the application.
How can i write a Variable in such way that it work same like MAX(DATE).
SESSIONID | MAX(DATE) | =16 |
---|---|---|
16 | 16 | |
100000 | 14 | 16 |
100002 | 16 | 16 |
100003 | 16 | 16 |
100004 | 16 | 16 |
100006 | 16 | 16 |
If you define a variable like : Max(DATE) //Note: no '=' symbol preceded
it would work as expected. However, if you use that variable in set analysis, it would work differently, only 16 would be produced (because set anaysis evaluates once for an object and not dimension-wise). And yes, =$(=MAX(DATE)) produces 16 beacuse, it gets evaluated outside the object where you use it. For better understanding, you might read the blog: http://community.qlik.com/blogs/qlikviewdesignblog/2013/11/18/dollar-expansions.
If you define a variable like : Max(DATE) //Note: no '=' symbol preceded
it would work as expected. However, if you use that variable in set analysis, it would work differently, only 16 would be produced (because set anaysis evaluates once for an object and not dimension-wise). And yes, =$(=MAX(DATE)) produces 16 beacuse, it gets evaluated outside the object where you use it. For better understanding, you might read the blog: http://community.qlik.com/blogs/qlikviewdesignblog/2013/11/18/dollar-expansions.
Hi Jitendra, variables are expanded before creating the table, in example, imagine you have a variable vMaxDate and a expression $(vMaxDate)
If variable value is: =Max(Date), expression is expanded from '$(vMaxDate)' to '16'
If variable value is: Max(Date) (without the equal sign), expression is expanded from '$(vMaxDate)' to 'Max(Date)'
Yes, i have checked that same.
I think same can possible in set analysis without making a variable.
I guess set analysis would not help you here. Use FirstSortedValue() with Distinct. Check my reply on your other thread here: http://community.qlik.com/thread/156497
Now i understand that i think MAX(DATE) in set Analysis will work same as its work in Expression. But it was not. So the other way is to make a variable of that and use that varaiable.
But why the Functions in Set Analysis not work same as they work in Expression... ?
Hi, when you using $-expansion like you're doing in =$(=MAX(DATE)), it's calculated to create the expression, so it does first =Max(Date), resolve it as '16', so your expression is calculated as =16.
Once all dimensions and expressions are expanded, the table is calculated.
Set analysis is the same, it's applied when creating the expression, applying the selections of set analysis and creating a subset, using that subset the whole table is calculated.
So none of those, $-expansion and set analysis is are affected by row values, they are applied to create the table.
That's why i was asking how can i use MAX(DATE) function in set Analysis so that it can work same as Its work in Expression fields. As what i know that is we have to use $(=<Exp>) when we want to use any functions etc.
Hi Jitendra, it can't be done with set analisys. Because of that in your other post we proposed workarounds using functions like FirstSortedValue() or Aggr()
Hi Ruben,
I understand that. but i was just thinking why this type of limitation is there in Set Analysis that's it.
I have already use the given suggestion.