Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

paulyeo11
Valued Contributor II

In what situation QV user still using YTD Flag and not using SET ?

Hi All

May i know the answer from QV developer ?

Or I re-phase the questions , what are the YTD Flag is not able replace by SET Analysis ?

The reasons i ask this question is because , if the answer of above is No , i like to know why YTD Flag is so powerfull which unable to replace by SET.

For example , in QS , i use YTD and not SET Analysis , because QS is not encourage user to click on month = current month and year = current year.

Paul

1 Solution

Accepted Solutions

Re: In what situation QV user still using YTD Flag and not using SET ?

HI,

Try this.

money(

Sum({<Year=, Quarter=, Month=, Date={'>=$(=YearStart(Today(), -1))<=$(=Addyears(monthend(Today()),-1))'}>} $(ColumnDim51)/1000)

, $(vMoneyFormatK))

Regards,

Kaushik Solanki

17 Replies
MVP
MVP

Re: In what situation QV user still using YTD Flag and not using SET ?

HI,

YOu can achieve YTD without using Flags, set expression below

=Sum({<Year=, Quarter=, Month=, Date={'>=$(=YearStart(Today()))<=$(=Today())'}>} Sales)

Hope this helps you.

Regards,

jagan.

MVP
MVP

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi,

Please check below link for similar type of expressions like QTD, MTD, YTD

Set Analysis for certain Point in Time

Regards,

Jagan.

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi,

Have a look at the link below.

Point-in-Time Reporting.qvw

Hope this helps to understand the difference.

Regards,

Kaushik Solanki

hirishv7
Honored Contributor

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi,

I think its based on your data,

You can go with Set analysis, If your data is till today() will go with Set Analysis for certain Point in Time  With Today()

or Else,

we can use  Set Analysis for Rolling Periods with Max of your Date Fields.

In Similar way you can create a Flags like last 12 months data in your script like this,

    If(Date>= AddMonths(Today(), -12), 1)as Last12MonthFlag

You can use it set analysis like

Sum( {<Last12MonthFlag={1}>}Sales)

But for better results and Performance go with set analysis in Front end.

Hope this helps,
PFA,

Hirish

paulyeo11
Valued Contributor II

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi Jagon

Thank you for share with me below expression for CY :-

money(

Sum({<Year=, Quarter=, Month=, Date={'>=$(=YearStart(Today()))<=$(=Today())'}>} $(ColumnDim51)/1000)

, $(vMoneyFormatK))

I have try your expression on CY , may i know how to modify the below expression to LY ?

I have try below , but it does not work :-

money(

Sum({<Year=, Quarter=, Month=, Date={'>=$(=YearStart(Today()-1))<=$(=Today())'}>} $(ColumnDim51)/1000)

, $(vMoneyFormatK))

MVP
MVP

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi Paul,

Try this

money(

Sum({<Year=, Quarter=, Month=, Date={'>=$(=YearStart(Today(), -1))<=$(=YearEnd(Today(), -1))'}>} $(ColumnDim51)/1000)

, $(vMoneyFormatK))

hirishv7
Honored Contributor

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi ,

Check  this,

If your are comparing between Years,

PFA,

Hirish

paulyeo11
Valued Contributor II

Re: In what situation QV user still using YTD Flag and not using SET ?

it should be 148 but display 802 , which is wrong

MVP
MVP

Re: In what situation QV user still using YTD Flag and not using SET ?

Hi,

Not sure, but the expression is correct.  Check the date format of Today() & Date field.  If you attach sample file it would be easier to find.

Regards,

jagan.

Community Browser