Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Talk to Experts, a LIVE Q&A Webinar. Bring your Qlik Sense Business questions on Aug. 4th. Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Display single value in Text Box using Min and Max functions

Can you help on to get only below required comment to display in "Text and Image" box in QS based on Max(Flag )  and Min(Date).

Load * Inline [
Flag,Date,Comment
0,'01/01/2019',comment1
0,'01/02/2019',comment2
0,'01/03/2019',comment3
1,'01/04/2019',comment4
1,'01/05/2019',comment5
1,'01/06/2019',comment6
1,'01/07/2019',comment7

];

date format: MM/DD/YYYY

Expected result:

comment4

Trying with : 

Only({< Date = {"$(=Min(Date))"},Flag={1} >} Comment)

Thanks for your quick help.

 

1 Solution

Accepted Solutions
Highlighted

Re: Display single value in Text Box using Min and Max functions

May be this

Only({<Date = {"$(=Date(Min({<Flag={1}>}Date), 'MM/DD/YYYY'))"}, Flag={1}>} Comment)

 

View solution in original post

7 Replies
Highlighted
Partner
Partner

Re: Display single value in Text Box using Min and Max functions

Try

Only({< Date = {'$(=MinString(Date))'},Flag={1} >} Comment)

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
Contributor III
Contributor III

Re: Display single value in Text Box using Min and Max functions

Hi,

not working if we have 2 conditions.

But ok for 1 condition.

Only({< Date = {'$(=MinString(Date))'} >} Comment)

Highlighted
Partner
Partner

Re: Display single value in Text Box using Min and Max functions

I understand, but max(date) min(flag) can be intepreted in at least three ways.

  • "The minimum day for the maximum flag" -> Comment4

=only({<
Flag = {$(=max(Flag))},
Date = {'$(=minstring({<Flag = {$(=max(Flag))}>}Date))'}
>} Comment)

 

  • "The maximum flag for the minimum day" -> Comment1

=only({<
Flag = {$(=max({<Date = {'$(=minstring(Date))'}>}Flag))},
Date = {'$(=minstring(Date))'}
>} Comment)

  • "The maximum flag and the minimum date." -> No hit in the data below

=Only({<
Comment = P({<Flag={'$(=max(Flag))'},Date={'$(=MinString(Date))'}>})
>} Comment)

 

Using this data:

Load * Inline [
Flag,Date,Comment
0,'01/01/2019',comment1
0,'01/02/2019',comment2
0,'01/03/2019',comment3
1,'01/04/2019',comment4
1,'01/05/2019',comment5
1,'01/06/2019',comment6
1,'01/07/2019',comment7

];

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted
Contributor III
Contributor III

Re: Display single value in Text Box using Min and Max functions

Other way, it should look for min date and flag=1

Highlighted
Partner
Partner

Re: Display single value in Text Box using Min and Max functions

In your example minimum date is '01/01/2019' and combined with flag=1 you wont get any hits. So the expression will return null().

 

Which comment number are you expecting from your data set?

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
Highlighted

Re: Display single value in Text Box using Min and Max functions

May be this

Only({<Date = {"$(=Date(Min({<Flag={1}>}Date), 'MM/DD/YYYY'))"}, Flag={1}>} Comment)

 

View solution in original post

Highlighted
Contributor III
Contributor III

Re: Display single value in Text Box using Min and Max functions

Thanks Sunny, its working like charm.