Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Reduce data to keep only last month data

Hi all!

We have a document with some sales data in it with dimensions= regions and time (including months, years, etc.). We want to loop and distribute a report to our managers using publisher. Each manager should get a report with the data from only his region and only for the last month (the reports a sent one time per month). We managed to configure publisher to send each manager only the data from his region (we have a mapping table email-region) and we make a loop reduce. The problem is that we can't figure out how dynamically reduce the data each time the task executes to keep only last month's data. For example the task is fired on the 1st of May - it should send the reports with data only for April. We could use set analysis (something like Month=$(=max(Month)), but we want this effect only on the reports. As we've seen in the QMC we can only statically select the valuse of a field (no functions) to reduce on.

Does anyone have any suggestion on this?

3 Replies
gksmithlcw
Creator
Creator

I have a similar situation where I need to select the last 36 months of data. Any help would be greatly appreciated.

Not applicable
Author

Hello, usually when i do similar stuff i have some preparations done inside the script of the application.

1) set up a variable which will say in which mode the qvw file will be reloaded (standard or email mode)

2) script the variables so when the email setting will run the fact tables will be reduced to only the max month.

3) you set up the separate reload process for general publishing and for email push in which on reload tab you define the variable value to be passed to the application.

This way you will still have one master file, but it will be possible to have different scenarios for the data inside of the file.

I hope i did understood your question properly and this will help you resolve the problem.

Best regards,

Lukasz

Not applicable
Author

One way to do it is to have condition on ur data, to load only latest month.

or

Do the reduction using trigger manually... see attachment

loadby value.PNG.png