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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pipuindia99
Creator III
Creator III

Rolling Month Function

Hi,

I have Month field in dimension and in expression i am using Rand() function to get random values. now based on my selection in month i want to see the data in chart like if i choose march, then i want to see from jan to mar, if i choose may then i want to see from jan to may...

Would appreciate if anyone can help me

9 Replies
sunny_talwar

May be like this:

RangeSum(Above(Sum({<Month>} Rand()), 0 RowNo())) * Avg(1)

pipuindia99
Creator III
Creator III
Author

it gives error if i use in dimension, it is not taking rowno()

sunny_talwar

In dimension? The above should work as an expression

pipuindia99
Creator III
Creator III
Author

It doesnot work, it shows error in same point for rowno(), can you check if something missing

pipuindia99
Creator III
Creator III
Author

it shows only for 1  month

RangeSum(Above(Sum({<Month>} Rand()), 0 ,RowNo())) * Avg(1)

sunny_talwar

What exactly are you trying to do? I am not sure I understand the reason to use Rand() here. Can you may be provide a context?

pipuindia99
Creator III
Creator III
Author

I have a bar chart and in that i have used Month field as dimension and in expression i have written Rand(), now when i select Month as mar from a filter i want to see data from jan to mar. and i dont want to see data for the month which i chose.

sunny_talwar

How about this:

Rand() * Avg({<MonthNum = {"$(='<=' & Max(MonthNum))"}>} 1)

UPDATE: More like this:

=Sum({<Month>}Rand()*10000)* Avg({<MonthNum = {"$(='<=' & Max(MonthNum))"}, Month>} 1)

Where MonthNum is created in the script like this:

LOAD Num(Month) as MonthNum

...


Capture.PNG

pipuindia99
Creator III
Creator III
Author

Thanks Sunny, I tried a different format it works. appreciate your help