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

Set analysis: show the last value of the last year

Hi Community!

My table is the following:

  

YEARMONTHDATEVALUE
2015630/06/201538
2015531/05/201537
2015430/04/201530
2015331/03/201533
2015228/02/201533
2015131/01/201514
20141231/12/201452
20141130/11/201448
20141031/10/201449
2014930/09/201446
2014831/08/201447
2014731/07/201445
2014630/06/201449
2014531/05/201453
2014430/04/201457
2014331/03/201460
2014228/02/201473
2014131/01/2014100

  
And I'm trying to display in a bar chart a double expression:

- the first one must show the last value of the current year: OK, I managed to get it by using the function max(DATE) within the set analysis.

- the second one must show the last value of the last year in order to compare with the current one (38) with the last average of the last year (52).

Do you know how could I obtain the max(DATE) of the max(YEAR-1)?

Thanks in advance to all of you!

Regards,

Vincent

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

For Current Year:

=Sum({<YEAR =, DATE={'$(=Date(Max(DATE)))'}>}VALUE)


For Previous Year:

=Sum({<YEAR =, DATE={"$(=Date(Max({<YEAR={'$(=(Max(YEAR) - 1))'}>} DATE)))"}>}VALUE)

Hope this helps you.


Regards,

Jagan.


View solution in original post

16 Replies
Gysbert_Wassenaar

Use YEAR as dimension and FirstSortedValue(VALUE, -MONTH) as expression.


talk is cheap, supply exceeds demand
sunny_talwar

Try this may be:

DATE = {"$(=Date(Max({<YEAR = {'$(=(Max(YEAR) - 1))'}>}DATE), 'DD/MM/YYYY')"}

Not applicable
Author

Thanks Gysbert, but in that case, it doesn't work at all because I have 4 years of results (the data attached above were just a small sample), but I always want to show only 2 years. I've tried with Incidents Type (my first dimension) and Year, but it didn't work (my expression is  =FirstSortedValue(Sum(VALUE), Month(DATE))

Any idea about how to restrict the Dimension in order to show always only 2 years?

Thanks again!

Not applicable
Author

Thanks Sunny, but no success for today 😞

If you have another idea, I'll be happy to ear it!

Thanks again for your help!

Gysbert_Wassenaar

Why not simply select those years?


talk is cheap, supply exceeds demand
Not applicable
Author

Because I need this bar chart to be interactive. If I select 2014, I'll pretend to visualize the last record of 2013 and the last record of 2014. That's whay I cannot use YEAR={'2015'} and YEAR={'2014'} in the different expressions of the Set analysis 😞

Gysbert_Wassenaar

Why not simply select those years?


talk is cheap, supply exceeds demand
Not applicable
Author

Sorry, I didn't understood you before. The user wants the screen to be displayed without any selection. That's why I cannot work with triggers.

Gysbert_Wassenaar

Let me rephrase that... Why not let the user select the years he/she is interested in?


talk is cheap, supply exceeds demand