Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Action-Packed Learning Awaits! QlikWorld 2023. April 17 - 20 in Las Vegas: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kishorepanduran
Creator III
Creator III

6 months rolling set analysis expression not working with aggr function

Hi,

avg(aggr(((Sum(a/b))*c),[emp ID],Month_Year))

This was my expression initially in the chart, then i got a requirement of 6 months rolling for that chart, i used the below set analysis expression, which is working fine in all expressions except the above one, where i have used aggr

Its not working with the aggr function.

{<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >}.

Please help me to find out how can i do 6 months rolling for this expression

Dimension - Month_Year

avg(aggr(((Sum(a/b))*c),[emp ID],Month_Year))



thanks..


1 Solution

Accepted Solutions
sunny_talwar

May be this

num(Avg({<Month_Year>}Aggr(((Sum({<Month_Year = {"=Date#(Only({1} Month_Year), 'MMM-YYYY') >= AddMonths(Max(TOTAL Date#(Month_Year, 'MMM-YYYY')), -5) and Date#(Only({1} Month_Year), 'MMM-YYYY') <= Max(TOTAL Date#(Month_Year, 'MMM-YYYY'))"}>}a/b))*Only({<Month_Year>} c)), empid, Month_Year)

),'#.##')

View solution in original post

34 Replies
Anonymous
Not applicable

this cant't work because set analysis have text values as input.

If you use >= or <= then you have to give the set analysis a format that the

Automatic Number Interpretation can convert into a numerical value.

Anonymous
Not applicable

you could try expression search instead for example:

{<Month_Year = {"=

(Month_Year>=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')))

and

(Month_Year<=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"})

>}

kishorepanduran
Creator III
Creator III
Author

I dont understand on what you are telling as TEXT .


(Sum({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} a/b))


The above expression will display the sum(a/b) as rolling six months in the chart.


Whereas, if i use the same set analysis exp with aggr function

avg(aggr(((Sum({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} a/b))*c),[emp ID],Month_Year))


Its not working.



Not applicable

try this

aggr(Sum({<Month_Year ={">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY'))<=$(=Date(addmonths(Max(Month_Year), 0),'MMM-YYYY'))"} >}a/b),[emp ID],Month_Year)

Anonymous
Not applicable

sorry, my mistake, try:

avg(aggr(((Sum({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} a/b))

*only({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} c)

),[emp ID],Month_Year))

could also be that you have to place the set modifier additionally within avg like

avg({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >}

aggr(((Sum({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} a/b))

*only({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} c)


),[emp ID],Month_Year))

kishorepanduran
Creator III
Creator III
Author

Not a problem. Thank you.

Tried your expressions, but it is not working.

Anil_Babu_Samineni

May be this?

avg(aggr(((Sum({<Month_Year = {">=$(=Date(addmonths(Max(Month_Year), -5), 'MMM-YYYY')) <=$(=Date(addmonths(Max(Month_Year), 0),  'MMM-YYYY'))"} >} (a/b)))*c),[emp ID],Month_Year))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Anonymous
Not applicable

please prepare a sample

kishorepanduran
Creator III
Creator III
Author

Thanks anil,

Its not working