Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've the below data in my app.
Table:
Load Date(Date#(Date,'MM/DD/YYYY')) as Date, Sales Inline [
Date, Sales
11/26/2020, 400
11/26/2021, 300
12/26/2021, 100
1/1/2022, 200
];
In the front end I want to load only data from previous year until current year previous month. I'm using the below expressions
Dimension: Date(monthstart(aggr(only({<Date = {">=$(=Date(Yearstart(today(),-1)))<=$(=Date(MonthEnd(today(),-1)))"}>}Date),Date)),'YYYY-MM')
Expression: RangeSum(Above(Sum(Sales),0,RowNo()))
Output:
Date | Value |
2021-11 | 300 |
2021-12 | 400 |
2022-01 | 600 |
Required Output
Date | Value |
2021-11 | 700 |
2021-12 | 800 |
2022-01 | 1000 |
@vikasshana Maybe like this
Dimension: Date(Date,'YYYY-MM')
Expression: Sum({<Date={">=$(=AddMonths(max(Date),-11))"}>}Aggr(RangeSum(Above(Sum({<Date=>}Sales),0,11)),Date))
I've tried your solution, but still the same
With the same sample date, this is the result. Could be the date format.
I'm using the below sample code where I'm changing the date format, but still the same result
Table:
Load Date(Date#(Date,'MM/DD/YYYY')) as Date, Sales Inline [
Date, Sales
11/26/2020, 400
11/26/2021, 300
12/26/2021, 100
1/1/2022, 200
];
Sum({<Date={">=$(=AddMonths(max(Today()),-11))"}>}Aggr(RangeSum(Above(Sum({<Date=>}Sales),0,11)),Date))
Thanks for that @BrunPierre , this expression is working with the sample data but when I use the same expression in my main application it is not working.