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

How do we get max year values

‌Hi all,

I have 2016 and 2015 years records in my table.

i Need to display only max year months datA in bar graph that too last 3 months

so I filter the data in script level where year(asofdt)>2015.

Then i am getting the bar with set analysis. As of now it is ok but

this application will get 2017 data, that time how to get max year values dynamically

PLease help help me to solve

1 Solution

Accepted Solutions
Kushal_Chawda

MaxYear:

LOAD Year(Max(asofdt)) as MaxYear

FROM Table;

let vMaxYear = peek('MaxYear',0,'MaxYear');

Data:

LOAD *

FROM table

where year(asofdt)='$(vMaxYear)'

View solution in original post

7 Replies
tresesco
MVP
MVP

If you are looking for current year data, you can try like:

Where year(asofdt)=Year(today());

If it is dependent on data, you could create a variable like:

Load

          max(asofdt) as MaxDt

From <>;

vMaxYear=Peek('MaxDt');

Then ..

Load

          *

From <> Where year(asofdt)='$(vMaxYear)';

varshavig12
Specialist
Specialist

where year(asofdt)= max(Year(asofdt))

sujeetsingh
Master III
Master III

You need to add a dynamic mechanism to handle upcoming years. Tresco suggested a good way but it is half done.

You need to handle both max YEAR as well as Today. The reason behind this is what if the data is having only data till 2016 and you are running the report in 2017 ?

Not applicable
Author

You want latest 3 months or maximum date?

Kushal_Chawda

MaxYear:

LOAD Year(Max(asofdt)) as MaxYear

FROM Table;

let vMaxYear = peek('MaxYear',0,'MaxYear');

Data:

LOAD *

FROM table

where year(asofdt)='$(vMaxYear)'

Not applicable
Author

Thank you guys

Not applicable
Author

It's working....! Thanks you