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

Show Today's month Quantity and Same Day Last Year's month Quantity

Hello,

Today is 15th January,2018. I want to show this month's data on the  bar chart until today  and also last year's data in this month(until 15th of January), I should show the quantity of these data,



To show the data that was on the 15th of January in 2017, I use this formula for the dimension =AddYears(Date(Today()),-1) 


To show the quantity that was in January until today(2018) I use this formula for the measure, that works quite well

=Sum({$<Year={2018}>}Quantity)


But I also want to make the same thing for the last year's data. I wrote this but this doesn't work

Sum({$<Year={{(AddYears(Date(Today()),-1)}}>}Quantity)


Capture.PNG


How can I make it ?

10 Replies
kaanerisen
Creator III
Creator III

Hi,

You can try this:

Sum({$<[DateField]={">=$(=AddYears(Date(MonthStart(Today())),-1)) <=$(=AddYears(Date(Today()),-1))"}>}Quantity)

Hope it helps,

Anonymous
Not applicable
Author

It doesn't work

I don't need Start of month,I need to sum Quantities for current period Like for 2 weeks that has passed this year and to compare this to the Sum of the same period Last year. For Example today is 15th January  and I want to sum quantities from 1-15 January in 2017 and 2018 and compare this data in the bar chart.

kaanerisen
Creator III
Creator III

Then, you need the replace monthstart with yearstart if I understand your need correctly.

If you can share your qvf file and the output you desire, I can look into it.

OmarBenSalem

if today is not 15 January, but rather 15 February? What do u want to compare?

1st January 2018 to 15 Feb  2018 and 1st Jan 2017 to 15 Feb 2017

or 1st Feb to 15 Feb 2017 and 2018?

Anonymous
Not applicable
Author

I want to compare 15th February 2017 to 15th February 2018 and 15 March 2017 to 15 March 2018 and etc

OmarBenSalem

what?

how do u want to compare March 2017 to 15 March 2018 while "today's date is 15 Feb 2018" and thus we do not have any data beyond this date???

OmarBenSalem

please try to refer to this thread.

Maybe you'll find in it sthing that could help u :

YTD, MTD issue

Anonymous
Not applicable
Author

For example,  tomorrow in the bar chart there should be 1/16/17 and 1/16/18 and the next day there should be 1/17/17 and 1/17/18 and etc

Like this,

Capture.PNG

pradosh_thakur
Master II
Master II

may be you would like to use valuelist(today(),addyears(today(),-1)) as dimension and sum(quantity) as measure

or

dimension = your date field

expression

Sum({$<[DateField]={" $(=today()),$(=addyears(today(),-1))"}>}Quantity)


please check the date format if required

Learning never stops.