Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Set ANalysis !!

HEy,

In my excel sheet , i have 3 columns :  Year , Customer , Sales.

I want to show Customer name for last year.

I have used following set analysis but it is giving error. Kindly tell em what to do.

Customer = p({<Year={$(max(Year)}-1>})

Thanks

14 Replies
MK_QSL
MVP
MVP

Create a Straight Table

Dimension

1) Year

2) =IF(Year = (Year(Today())-1),Customer)

Tick Suppress When Value is Null for 2nd Dimension

Expression

SUM(Sales)

tresesco
MVP
MVP

Try like:

Customer = p({<Year={"$(=max(Year)-1)"}>})

nikhilgarg
Specialist II
Specialist II
Author

Hey,

It is still giving me error.

anbu1984
Master III
Master III

Can you post sample qvw

tresesco
MVP
MVP

Try to post your complete expression.

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi Nikhil,

for getting  customer for last year : only({<Year={'$(=max(Year))-1>}) Customer)

for getting  sales for last year : Sum({<Year={'$(=max(Year))-1>}) Sales)

nikhilgarg
Specialist II
Specialist II
Author

Hey,

In my question , i have already uploaded my expression.

Thanks

tresesco
MVP
MVP

Missing quotes; improper parenthesis. Try:

only({<Year={'$(=max(Year)-1)'}>} Customer)

sum({<Year={'$(=max(Year)-1)'}>} Sales)

:Note: Only() would only work if there is single customer for the max year, otherwise, try with concat(),k like:

Concat({<Year={'$(=max(Year)-1)'}>} Customer, ',')

varunjain
Creator
Creator

try this

ONLY( {$<Customer = p({<Year={"$(=max(Year)-1)"}>})>} Customer )