Skip to main content
Announcements
Do More with Qlik - Qlik Cloud Analytics Recap and Getting Started, June 19: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to write an expression?

Hi

I am new to Qlikview and am stuck with a problem. All my other graphs uses specific dates except for 1 graph which uses date range. So I created a new variable called Date (date).

I have 4 products A, B, C and D

I want to display a straight table with newly created date variable Date(date) of the relevant Product or Products that are being selected. For example, if Product A is selected, Date (date) for Product A is displayed. If Product B and A is selected, the Date (date) for Product A and B is selected. If 3 products selected , for example, Product A, B, D etc, then Date (date ) for Product A, B and D will be displayed.

How should I write the expression.?

Can someone please help?

8 Replies
Not applicable
Author

hi,

take straight table

dim product

exp only(Date)

-or-

=sum(num(Date(date,'dd-mm-yyyy')))

& properties>number>select number format setting>Date with format DD/MM/YYYY

datanibbler
Champion
Champion

Hi Florence,

can you elaborate a bit on that? I don't quite understand what it is you're trying to achieve.

So you have four products and every product has exactly one date associated with it?

Do you just want to display those dates acc. to the selection or do you want to make a graph of that?

Are there any kind of events attached to those products that you want to display?

Do you have some kind of master_calendar in your app? That makes creating different graphs with some date_dimension easier in general.

Best regards,

DataNibbler

anbu1984
Master III
Master III

Set date variable to Date(Max(date))

Expr: $(vDt) //vDt is date variable

Not applicable
Author

Hi

The problem does not lies with the writing of the expression for the date range, the problem here lies with an expression to show the selected  product. There is already a date varaible being created for date range:=if(Date >=vMinSelectedDateNews and Date <=vMaxSelectedDateNews, Activity_News)

I believe that this expression for date range is correct.

Now I need to write an expression to show dates of the selected product (s)

Not applicable
Author

Yes you are right.

Each product has one date associated with it. So for example, I select February 2014's data, the news for February 2014 (within this month) will be shown. For this function, I have already had an expression in place, named Date (date):

=if(Date >=vMinSelectedDateNews and Date <=vMaxSelectedDateNews, Activity_News)

Now I need to write another expression to show the dates for the selected product I selected.

For example, if Product A is selected, Date (date) for Product A is displayed. If Product B and A is selected, the Date (date) for Product A and B is selected. If 3 products selected , for example, Product A, B, D etc, then Date (date ) for Product A, B and D will be displayed.

Not applicable
Author

Hi Florence

try like this

Dimension : Product

Expression : sum(Max(Date)

Change the format of your date as per your data it can change in the number Tab.

Not applicable
Author

Hi Raja

I tried, but it says error in calculated dimension

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want the dates displayed in a text box (for example), you can use this expression:

=concat(Date, ',')

otherwise, it would be good if you could post an example QVW document.

Best,

Peter