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

Chart - Month/Year to date

Hi,

How do I make my chart only show data up until todays date for previouse years?

I have tried doing it as an Expresstion like this:

Count ({<YEAR={$(vPreviousYear-1)},MONTH={'<=$(vMonth)'},DATE={'<=$(vToday)'}>}DATA)

But the result it the date is set as max in very month. So today it will only show up until todays date in all the present month also.

But I what the full data shown in the past months, and only month-to-date i present month.

12 Replies
jmvilaplanap
Specialist
Specialist

Hi

I understand that for explample if today is 11/07/2017 you want to show data from 01/01/2016 to 11/07/2016.

Then, change DATE for DAY (if you have this field).

Regards

Anil_Babu_Samineni

Will you provide variables which you used??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sergio0592
Specialist III
Specialist III

Hi,

For current year, from 1er of month to today :

=Count({<Year, Month,Date={">=$(=MonthStart(today())) <=$(=today())"}>} Data)

For previous year, from 1er of month to today :

=Count({<Year,Month,Date={">=$(=MonthStart(today(),-12)) <=$(=AddYears(today(),-1))"}>} Data)

Hope it helps.

Not applicable
Author

Hi Jose,

Thanks for your reply.

When I try your solution, I'll get a blank chart.

Here are what I tried:

Count ({<YEAR={$(vPreviousYear)},MONTH={'<=$(vMonth)'},DAY={'<=$(vToday)'}>}DATA)

Not applicable
Author

Hi Anil,

Here are the variables I used:

vPreviousYear) =year(today())-1

vMonth =month(today())

vToday =date(Today())

vTodayPreviousYear) =date(monthstart(today())-365,'DD-MM-YYYY')

Not applicable
Author

Jean-Baptiste RENAULT skrev:

Hi,

or previous year, from 1er of month to today :

=Count({<Year,Month,Date={">=$(=MonthStart(today(),-12)) <=$(=AddYears(today(),-1))"}>} Data)

Hope it helps.

Hi Jean-Baptiste,

When I try this, I get a blank result. Why could that be?

jmvilaplanap
Specialist
Specialist

Hi mortenrostved

What's the value of $(vToday)? Is needed a day not a date, because you are comparing days. Maybe the error is there.

If is a date, you can replace it with $(=day(today()))

Regards

Not applicable
Author

The value of vToday =date(Today())

Then I try your solution with $(=day(today())), I getting data in the chart, but as I can see, I'm geting the result of the day, and not as I need: the date. I need to get the full month of the previouse month, and in the present month, I only want the data from the 1th of the month until today (ex 12th july).

Did I make my self more clear now?

sergio0592
Specialist III
Specialist III

Have you tried with the formula for current year? Does it works for you?

=Count({<Year, Month,Date={">=$(=MonthStart(today())) <=$(=today())"}>} Data)

You can try with :

=Count({<Year,Month,Date={">=$(=MonthStart(date(today()),-12)) <=$(=AddYears(date(today()),-1))"}>} Data)