Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Case Portal has moved to Qlik Community! Read the FAQs to start exploring Support resources.
cancel
Showing results for 
Search instead for 
Did you mean: 
vikasshana
Creator
Creator

Dynamic changing as per selection

Hi,

Looking for help in writing an expression. I’ve the below table in my qlik document.

Valueamountdate
A10001/01/2018
A20014/01/2018
A30003/02/2018
A20014/02/2018
A20006/03/2018
A20020/03/2018

now my requirement is when every user selects month in list it has to show current month and previous month value. For example if user select January in month it has to display previous month values as 0 (because there is no previous month) and current month as ‘300’  as below.

Valueprevious month
current month
ANull or 0300

IF the user selects February i want to see the output as below

ValuePrevious monthcurrent month
A300500

Message was edited by: Bharath Vikas Shanagonda  I’m sorry I’ve updated my requirement. Instead of month column I will be using date column

8 Replies
Anil_Babu_Samineni

May be this?

Where month_num created in script using below.

Num(Month(Date#(month,'MMMM'))) as month_num

Then, Create table

Previous Month

Sum({<month,month_num = {"$(=Max(month_num-1))"}>} amount)


Current Month

Sum({<month_num = {"$(=Max(month_num))"}>} amount)

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)
Anil_Babu_Samineni

PFA from Update?

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)
vikasshana
Creator
Creator
Author

Just updated the requirement Anil.

vikasshana
Creator
Creator
Author

Didn’t have access to qlikview now as I’m using my mobile. Can you put the expression here please.

Anil_Babu_Samineni

Expression is same, Script looks this?

LOAD *, month(Date#(date,'DD/MM/YYYY')) as month,Num(month(Date#(date,'DD/MM/YYYY'))) as month_num Inline [

Value, amount, date

A, 100, 01/01/2018

A, 200, 14/01/2018

A, 300, 03/02/2018

A, 200, 14/02/2018

A, 200, 06/03/2018

A, 200, 20/03/2018

];

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)
vikasshana
Creator
Creator
Author

thanks for that Anil, it is working fine and i've tested in straight table. Based on the selection it is giving me the result which I'm expecting. I'm giving the label name for an expression manually (current and previous) but I'm looking for an expression to change the label name dynamically.

For example if I select Feb month in the list box instead of previous the label name has to be Jan and for current it has to be Feb.

vikasshana
Creator
Creator
Author

stalwar1‌ can you help me on this please.

Anil_Babu_Samineni

You can use Label like

Prev Month

=Date(Max(month)-1,'MMMM')


Current Month

=Date(Max(month),'MMMM')

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)