Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
bharatkishore
Creator III
Creator III

Calculate data from specific dates

Hi All,

I have data from 2014 Jan to 2019-Sep.

Now i need to calculate data from 2015 - Jan to 2016 - Dec.

It should not be hard-coded, and every year it should change automatically.

Kindly help.

Thanks,

Bharat

1 Solution

Accepted Solutions
its_anandrjs

Then in formula use this expression

=sum({<Year={">=$(=Max(Year)-2) <=$(=Max(Year)-1)"},Month={">=$(=Max(Month)-12) <=$(=Max(Month))"}>}SystemYr_sql)

View solution in original post

17 Replies
its_anandrjs

Elaborate more

1. Do you have date fields in model

2. You need to load data

3. Or else you need to calculate data.

bharatkishore
Creator III
Creator III
Author

Hi Anand,

I have date field below image for reference:

T.PNG

I have data from Jan 2014 to Sep 2017.

I need to calculate sum(myfield) from Jan 2015 to Dec 2016.

Please let me know if you require anything more.

Thanks,

Bharat

its_anandrjs

Loading data from table try this

Load

*

From Source Where

Datefield <= YearStart(AddYears( Max(Datefield), -3)) and

Datefield >= YearEnd(AddYears( Max(Order_Date), -2))

its_anandrjs

Your date is in string format or num format.

Or can you provide sample data.

bharatkishore
Creator III
Creator III
Author

Thanks for the reply.

PFA qvw for more understanding.

Thanks,

Bharat

bharatkishore
Creator III
Creator III
Author

pfa

qlikview979
Specialist
Specialist

May be like this

sum({<Monthyear={ >=$ (=Yearstart(Monthyear),-3) <=$ (=Yearend(Monthyear),-1) }>}Myfield)

-Mahesh

its_anandrjs

Check the attached

Expre:-

=sum({<Year={">=$(=Max(Year)-1) <=$(=Max(Year))"},Month={">=$(=Max(Month)-12) <=$(=Max(Month))"}>}SystemYr_sql)

bharatkishore
Creator III
Creator III
Author

Hi Anand,

Request you please find the attached file and there i have derived a new MonthYear field.

With this can we achieve and i need data from 2015 Jan to 2016 Dec.

In your file it is Jan 2016 to Sep 2017.

Please let me know if you require anything more.

Thanks,

Bharat