Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
NareshGuntur
Partner - Specialist
Partner - Specialist

Chart calculation in the script

Hi Geeks,

This might be simple but I am breaking my head. I want the calculation that is done on the chart to be implemented in the script.

Open Inventory = Previous Month Closing Inventory(Expression : Above(Closing Inventory))

Closing Inventory = Open Inventory + In Sales - Out Sales

This is easy in the chart as I can use the column labels and get it done but seems tricky in the script.

Reason behind needed in the script: If nothing is selected, all good. But if I select a month, the calculation starts for the selected month. Open Inventory can't take the previous month Closing Inventory. So, if it is done in the script, everything will be pre-calculated.

I tried to be detail to my best . Let me know if any questions and thanks in advance.

 

-Naresh

Labels (4)
1 Solution

Accepted Solutions
Taoufiq_Zarra

😵finally

attached a version

left -> load Script

right->UI (your example)

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

4 Replies
NareshGuntur
Partner - Specialist
Partner - Specialist
Author

Guys, Anyone there? 😑

 

-Naresh

pasi_lehtinen
Partner - Contributor III
Partner - Contributor III

I think you can achieve the desired output with peek() -script function. Just need to use order by clause in order to retrieve the data from prev yearmonth as you desired. Also make sure that you have correct granularity in your script table.

 

Edit: Alternatively you may ignore the selection in chart expression with set analysis. This way you always have previous month available even though user has made a selection to a specific month. 

Taoufiq_Zarra

😵finally

attached a version

left -> load Script

right->UI (your example)

Capture.JPG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
Brett_Bleess
Former Employee
Former Employee

Did Taoufiq's post and example QVW get you what you needed?  If so, do not forget to return to your thread and on his post, use the Accept as Solution button to give him credit for the assistance and let other Members know that worked for your use case.  If you did something different, consider posting that and mark it, and if you are still working on things, leave an update on what you need.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.