Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis with variables and also the Variable in Expression

Hello all,

I'm want to show YTD Amount of previous Month

.

I hold 4 variables:


2 Variables for Previous Month

vMinSourceDate = date(MonthStart(addmonths(Min(date(TransDate)),-1)),'MM/DD/YYYY')

vMaxSourceDate = date(MonthEnd(addmonths(Min(date(TransDate)),-1)),'MM/DD/YYYY')


2 Variables for Current Month


vCurrentMonthStartDate= date(MonthStart(Min(date(TransDate))),'MM/DD/YYYY')

vCurrentMonthEndDate= date(MonthEnd(Min(date(TransDate))),'MM/DD/YYYY')


I created one Variable vTestAmt  in which the  addition Value of Current Month and Previous Month.

Variable Expression is :

vTestAmt = Sum({<Year=, Month=, TransDate = {">=$(=vMinSourceDate)<=$(=vMaxSourceDate)"}>}[YTD Amt])+(Sum({<Year=,Month=,TransDate = {">=$(=vCurrentMonthStartDate)<=$(=vCurrentMonthEndDate)"}>}MTD*Percent)/100)

And now I want to use above variable  " vTestAmt " in Straight table expression  for previous Month  Value  like:


Sum({<Year=, Month=,  TransDate = {">=$(=vMinSourceDate)<=$(=vMaxSourceDate)"}>}$(vTestAmt))

and It doesn't work for me.I am want to add the previous Month value in the current Month Value so I need to find this value .



What am I doing wrong?


Please give me any Idea. Any help will be appreciated .

Thanks

Deepak.

1 Reply
tresesco
MVP
MVP

Could you post your sample qvw?