Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Total Sales for each Year

Hello!

I am trying to get row number for total orders for each year inside a Straight table.

I am using the expression: =COUNT({<Year={$(=(Max(Year)))}>} OrderID) to what I believe should show the amount of orders(row-wise) for that year. I use that same expression but with -1, -2 etc. to get the previous year until the years in the excel-file has ended. But when I show this in the table, I get the same value on every expression. It is as if all I get is how many orders that exist in the file, and does not modify which year it should show how many orders there is.

I recieve the same error in my tables when I try to show total sales for every year, =SUM({<Year={$(=(Max(Year)))}>} Sales) is the expression for that.

If anyone here realize my problem, kindly advise on how to right this wrong.

If you need more info, please tell me and I will gladly give it.

5 Replies
sunny_talwar

What do you see when you put =Max(Year) in a text box object?

swuehl
MVP
MVP

It would be easier to help you if you could upload a small sample QVW that demonstrates your issue.

Some possible issues to check:

- Year field is not numeric, hence max() does not work (try a text box with =max(Year) )

- Year field shows a different textual representation than its numeric value (compare max(Year) with e.g. Year list box values)

- Year field is not connected to OrderID in the data model (does the count(OrderID) change when you select in field Year?)

Not applicable
Author

I get 2010. Which is correct

Not applicable
Author

I think I know what was at fault here. The data in my excel-files are somewhat weird, I one summary report which is over year 2005 to 2010, and one sales file where the sales has been done in the year 2005 - 2008. When I switched years I got the correct values.

Thanks for the help anyways!

sunny_talwar

Great, I am glad you were able to figure it out.

Please close the thread by marking your answer as correct and any helpful answers.

Best,

Sunny