Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Scenario to display sales data in between years using set analysis.

Recently I attended an interview. Below is one of the questions asked. Could any one please help me with the answer.

Suppose we have sales data for years from 2001 to 2015. If I select year 2015, the chart should display sales data for years 2010 to 2015. Similarly, If I select year 2010, the chart should display sales data for years 2005 to 2010.

How can you do that using set analysis ?

5 Replies
maxgro
MVP
MVP

you ca use a chart with year as dimension and this expression

sum({$ <year={">=$(=max(year)-5)<=$(=max(year))"}> } sales)

Not applicable
Author

Thanks Maxgro.

I believe max(year) is identical to year. Please correct me if I am wrong.

Do you think the above expression gives correct results if I select year as 2010  ?

Thanks,

Chowdary

maxgro
MVP
MVP

small example in the attachment

2.png1.png

Not applicable
Author

Thanks maxgro.

It works

maxgro
MVP
MVP

please close the thread