Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
I've 3 Years data (2013,2014,2015). If i select 10-Aug-2015 date it has to displays data from 9-Aug-2014 to 10-Aug-2015? How to achieve this?
Create a straight table with the date as the dimension. Add an expression of the form:
=Sum({<datefield = {">=$(=AddYears(Max(datefield), -1)) <=$(=Date(Max(datefield)))"}>} metricfield)
Replace datefield and metricfield with the correct fieldnames for your date and metric fields.
SUM({$<YourDateField = {">=$(=Date(AddYears(Max(YourDateField)-1,-1))<=$(=Date(Max(YourDateField)))"}>}YourFieldName)
EDITED:
SUM({$<
InvoiceMonth = ,
InvoiceYear =,
InvoiceWeek=,
InvoiceQuarter=,
InvoiceDate = {">=$(=Date(AddYears(Max(InvoiceDate)-1,-1)))<=$(=Date(Max(InvoiceDate)))"}>}Sales)
If your Date field format is 'DD/MM/YYY'
=sum({<Date ={">=$(=date(addyears(max(Date),-1),'DD/MM/YYYY'))<=$(=date(max(Date),'DD/MM/YYYY'))"},Year=,Month=>}Amount)
Change the Date format in your expression as per the what date format you have