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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with date selection

Hello,

I have trouble with setanalysis.

I my QVW, there is possible to select a date from 3 List Box (Year, Month, Day).

I want to be abble to auto calcule the end of selection; if the user pick only a year i need to have the last day of this year in my set analysis like (31/12/YEAR Selected) with this format (DD,MM,YYYY).

If he pick YEAR / MONTH i need to have (28 or 29 or 30 or 31 (depend on month)/MONTH/YEAR).

if he pick the full date, i have no calcul to do.

With if formula i can do it, but can't use IF expression in set analysis... so i m stuck.

The if statement who work :

=if(IsNull(GetFieldSelections(YEAR)),

  MaxString(CNT_Date),

  if(IsNull(GetFieldSelections(Month)),

  DATE(MonthEnd(MakeDate(Year,12))),

  if(IsNull(GetFieldSelections(Day)),

     DATE(MonthEnd(MakeDate(Year,Month))),

  Date(MakeDate(Year,Month,Day))

  )))

The expression i m trying to use :

=Count({<CNT_Contribution={11},CNT_Date={EXPRESSION}>}CNT_IdDoc)

Thanks to anyone who can help me.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Use a variable vExpression.

vExpression:

=Date(

  if(

     IsNull(GetFieldSelections(YEAR)),

    Max(CNT_Date),

    if(

      IsNull(GetFieldSelections(Month)),

      MonthEnd(MakeDate(Year,12)),

      if(

        IsNull(GetFieldSelections(Day)),

        MonthEndMakeDate(Year,Month),

        MakeDate(Year,Month,Day)

      )

    )

  )

,'DD/MM/YYYY')

The expression i m trying to use :

=Count({<CNT_Contribution={11},CNT_Date={'$(vExpression)'}>}CNT_IdDoc)


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
Anonymous
Not applicable
Author

I would define a variable with your expression

so you could test yor Expression with a textobject and your variable if the Expression works fine

in your Chart you Need to define with set analysis

=Count({<CNT_Contribution={11},CNT_Date={'$(=yourvariable)'}>}CNT_IdDoc)

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Use a variable vExpression.

vExpression:

=Date(

  if(

     IsNull(GetFieldSelections(YEAR)),

    Max(CNT_Date),

    if(

      IsNull(GetFieldSelections(Month)),

      MonthEnd(MakeDate(Year,12)),

      if(

        IsNull(GetFieldSelections(Day)),

        MonthEndMakeDate(Year,Month),

        MakeDate(Year,Month,Day)

      )

    )

  )

,'DD/MM/YYYY')

The expression i m trying to use :

=Count({<CNT_Contribution={11},CNT_Date={'$(vExpression)'}>}CNT_IdDoc)


talk is cheap, supply exceeds demand
Not applicable
Author

Hi,

Thanks Gysbert and Rudolf about the help.

Have a good day both of you two