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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
arethaking
Creator II
Creator II

Default value in text box

Hi ,

I have the data like this on monthly level.

   

ProductAmountMonth NameMonthYearStatus
P17AugAug-162016A
P17SepSep-162016A
P110JanJan-152015A
P110FebFeb-152015A
P110AprApr-152015A
P110JanJan-162016A
P110FebFeb-162016A
P110MarMar-162016A
P110AprApr-162016A
P110MayMay-162016A

By default , I want to show Amount value for the latest month in a text box . It should change the value based on month,Year,Product selection.

I am using the below formula. But it is not working.Please help me.

=SUM({<Year={'$(=Max(Year))'},Month={'$(=Max(Month))'},Status={'A'}>} Amount)

8 Replies
marcus_sommer

You need for this a numeric month-fields and not a string-field.

- Marcus

Anonymous
Not applicable

This part would not work here Month={'$(=Max(Month))

Max() would return integer value and your month is having value like Aug-16 etc.

Then how it will work?

Workaround like, create a inline function like

Load * inline

[MonthName, MonthNo

Jan, 1

Feb,2

and so on..

];

Then map this table into your table using applymap()

and use MonthNo={'$(=Max(MonthNo))

Anonymous
Not applicable

antoniotiman
Master III
Master III

Hi Aretha,

in Your Doc [MonthName] is Date/Dual Field, so try

=SUM({<MonthName={'$(=Max(MonthName))'},Status={'A'}>} Amount)

Regards,

Antonio

Anonymous
Not applicable

Hi Aretha,

Think that max(month) is ever 12, then, you have to calculate the max month of the max year.

=SUM({<Year={'$(=Max(Year))'},Month={'$(=Max({$(=Max(Year))}Month))'},Status={'A'}>} Amount)

Regards!!

tamilarasu
Champion
Champion

Hi Aretha,

Change your load your script like below and check.


sales:

LOAD Amount,
Product,
Date(date#(Year,'YYYY'),'YYYY') as Year,
Date(date#([Month Name],'MMM'),'MMM') as Month,
Date(date#([Month Name] &'-'& right(Year,2),'MMM-YY'),'MMM-YY') as MonthName
FROM
[Sales Data.xls]
(
biff, embedded labels, table is Sheet1$);



Anil_Babu_Samineni

Try Static, They look Dynamic

Static

Sum({<Year = {'2016'}, Month={'Dec'}, Status={'A'}>}Amount)

If this expression give any value then look script, Is that table is Simple excel table or have you used any other functionalities.

- ANIL

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

Hi Aretha,

First change the script as:

LOAD * INLINE [
MonthID, Month
1, Jan
2, Feb
3, Mar
4, Apr
5, May
6, Jun
7, Jul
8, Aug
9, Sep
10, Oct
11, Nov
12, Dec
]
;


Use this formula:

=SUM({<CYear={$(=Max(CYear))},Month={$(=Max(MonthID))}>}ExtInvMisc)

My year field is CYear and Month field is Month. So for your data use Month Name and Year.

Thanks