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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to calculate by Current Month and Year

I need to calculate the closing balance of the transaction which is having 3 fields

1. Transdate as [TRANSDATE]

2.Account Number as [ACCOUNTNUM]

3. Closing balance as [Closing_fld]

I defined the expression which is below not working, please correct me where I did mistake ("Error in Expression")

SUM(

{$<

[TRANSDATE.autoCalendar.Year] = {YEAR(Today()},[TRANSDATE.autoCalendar.Month] = {>month(today())},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

14 Replies
Anil_Babu_Samineni

Perhaps this?

SUM(

{$<

[TRANSDATE.autoCalendar.Year] = {'$(=YEAR(Today())'},[TRANSDATE.autoCalendar.Month] = {"= [TRANSDATE.autoCalendar.Month] > month(today())"},

[ACCOUNTNUM] = {">=$410010<=$440000"}

>}

[Closing_fld])


OR


TRANSDATE.autoCalendar.Month] = {'> $(=month(today()))'}

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
Author

not working, could you please provide the correct syntax for bot current Year and current Month.

Anil_Babu_Samineni

Perhaps this?

SUM({$<[TRANSDATE.autoCalendar.Year] = {'$(=Max([TRANSDATE.autoCalendar.Year]))'},[TRANSDATE.autoCalendar.Month] = {'$(=Max([TRANSDATE.autoCalendar.Month]))'}, [ACCOUNTNUM] = {">=$410010<=$440000"} >} [Closing_fld])

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
Author

Also no result

if I put similar below, I'm getting the result as specific (by numbers) year and month, but i need to get for current M/Y without defining the period

instead of defining 2017, i need expression.

instead of defining 9, i need expression.

SUM(

{$<

[TRANSDATE.autoCalendar.Year] = {'2017'},[TRANSDATE.autoCalendar.Month] = {'>=9<=9'},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

Anil_Babu_Samineni

Off course, That not make sense to me because of static. Can you play with below

SUM(

{$<

[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},[TRANSDATE.autoCalendar.Month] = {"$(='>=' & Month(Today()))"},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

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
Author

Thank you for keeping support.

I tried with the below in 3 scenario

scenario 1

if i comment for month, I'm getting Year value  with below

{$<

//[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},

[TRANSDATE.autoCalendar.Month] = {$(= Month(Today()))},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

scenario 2

if i comment for Year, I'm getting Month (all months) respective of Year value  with below

{$<

[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},

//[TRANSDATE.autoCalendar.Month] = {$(= Month(Today()))},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

scenario 3


if i remove the comment to work for Year and month result is zero (Year and Month together not working)

{$<

[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},

[TRANSDATE.autoCalendar.Month] = {$(= Month(Today()))},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

Anonymous
Not applicable
Author

Thank you for keeping support. (sorry small correction)

I tried with the below in 3 scenario

scenario 1

if i comment for month, I'm getting Year value  with below

{$<

[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},

//[TRANSDATE.autoCalendar.Month] = {$(= Month(Today()))},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

scenario 2

if i comment for Year, I'm getting Month (all months) respective of Year value  with below

{$<

//[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},

[TRANSDATE.autoCalendar.Month] = {$(= Month(Today()))},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

scenario 3


if i remove all the comment to work for Year and month result is zero (Year and Month together not working)

{$<

[TRANSDATE.autoCalendar.Year] = {$(=Year(Today()))},

[TRANSDATE.autoCalendar.Month] = {$(= Month(Today()))},

[ACCOUNTNUM] = {'>=$410010<=$440000'}

>}

[Closing_fld])

Anil_Babu_Samineni

That means, It has been format issue, Can you check how this field [TRANSDATE.autoCalendar.Month] looks like? Because, Month(Today()) returns in 'MMM' format only.

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
Author

how can we check [TRANSDATE.autoCalendar.Month]