# Sublist Function: Unable to retrieve data wrt Year

Generic selectors
Exact matches only
Search title only
Search in content
Search in all posts
Search in pages
Questions
Solved1.41K views
0

Hello,

I am trying to retrieve YTD revenue values from LayoutofMonth matrix to Final View Matrix.

I used following formula:
Revenue=sum(sublist(LayoutofMonth::Year:Month:Revenue,1,#Month))

The formula works for the first year 2018. But, I am unable to retrieve the value of revenue from the next year onwards e.g 2019

What am I missing??

### Attachments

Sample Model.model

0

This should get you what you need.

Revenue = sum(sublist(LayoutofMonth::Year:Month:Revenue
, (((#Year-1) * 12) +1 ) //Year Index less 1 * 12 then add 1 to get the first month of the year.
, #Year:Month) )

0

Hi,

Try this formula:

Revenue = sum(sublist(LayoutofMonth::Month:Revenue; 1))
skip Better Worse

0

But my aim with this model is to get the sum of the revenue(Year to date) from the starting fiscal year month of Oct to the month selected from the drop down menu in the category month.
And when I change the year it should sum again from oct for that year to the month selected.
e.g
If i chose month June, then for year 2018 the actual should be \$40
and for year 2019 it should show actual as \$6000

0

When is use the following formula:
Revenue=sum(sublist(LayoutofMonth::Year:Month:Revenue,1,#Year:Month))
skip Better Worse,%// using Layoutof Analysis::Year as Year

I can get the summation of actual wrt month and year but I cannot change the starting month to oct of specified year. It still refers to Oct of 2018.

when i change the formula to:
Revenue=sum(sublist(LayoutofMonth::Year:Month:Revenue,#Year:Month:Oct,#Year:Month))
skip Better Worse,%// using Layoutof Analysis::Year as Year

I get #Bounds error

0

,y quick fix:
Revenue=sum(sublist(LayoutofMonth::Year:Month:Revenue,switch(@Year="2018",1,@Year="2019",13,@Year="2020",25,@Year="2021","37",1,),#Year:Month))
skip Better Worse,%// using Layoutof Analysis::Year as Year

Let me know if there is a better way to optimize this