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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
chapil
Contributor III
Contributor III

SET ANALYSIS exppression

Hello guys, 

I would like to do a set analysis for a measure based on a dimension filter :

On a line chart I want : per month, 1 line for the data (avg delay payment of current year N) and 1 line for N-1 (same measure) 

I wrote this expression in my measure item : 

avg({<[PAYMENT DATE] = {"=year([PAYMENT DATE])= max(year([PAYMENT DATE])) "}>} [DATE INV] - [DATE PAYMENT]) 

This is not working but I don't know how to put a dynamic value without using a variable. 

Can I do it without or not ? 

Thanks a lot 

 

1 Solution

Accepted Solutions
Kushal_Chawda
MVP
MVP

@chapil  try below

avg({<[PAYMENT DATE] = {"=year([PAYMENT DATE])= year(max(total [PAYMENT DATE]))"}>} [DATE INV] - [DATE PAYMENT]) .......for N

 

avg({<[PAYMENT DATE] = {"=year([PAYMENT DATE])= year(max(total [PAYMENT DATE]))-1"}>} [DATE INV] - [DATE PAYMENT]) .... for N-1

View solution in original post

4 Replies
Kushal_Chawda
MVP
MVP

@chapil  You can generate master calendar using Payment Date and use the year field from master calendar like below

avg({<Year= {"$(=max(Year))"}>} [DATE INV] - [DATE PAYMENT]) ..... for N

avg({<Year= {"$(=max(Year)-1)"}>} [DATE INV] - [DATE PAYMENT]) ....for N-1

chapil
Contributor III
Contributor III
Author

hello, yes it could be like this but I don't have rights to do master items or master calendar so I m trying to do another way 

 

thanks for your answer 

Kushal_Chawda
MVP
MVP

@chapil  try below

avg({<[PAYMENT DATE] = {"=year([PAYMENT DATE])= year(max(total [PAYMENT DATE]))"}>} [DATE INV] - [DATE PAYMENT]) .......for N

 

avg({<[PAYMENT DATE] = {"=year([PAYMENT DATE])= year(max(total [PAYMENT DATE]))-1"}>} [DATE INV] - [DATE PAYMENT]) .... for N-1

chapil
Contributor III
Contributor III
Author

Thanks a lot, 

this is working !