Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have sales by invoice date in my model. For every line item, i have the invoice date, fiscal period work day number, period days,and many other attributes. I need help with calculating accumulated sales by day.
This is the formula that I started. I'm also showing the sample table and results desierd. I am intending to add a combo chart showing the accumulated sales by day in a fiscal period. I appreciate you help with fixing this formula.
Sum({$<YEAR_PER={'2018_001',PER_WD={">=0 <=$(=Num(Max(PER_WD)))"}>}SALES)
Example Table:
YEAR_PER | INV_DATE | PER_WD | PER_DAYS | SALES |
2018_001 | 1/1/2018 | 0 | 24 | 10 |
2018_001 | 1/2/2018 | 1 | 24 | 100 |
2018_001 | 1/3/2018 | 2 | 24 | 100 |
2018_001 | 1/4/2018 | 3 | 24 | 100 |
Mock Results needed:
PER_WD | PER_To_Date |
0 | 10 |
1 | 110 |
2 | 210 |
3 | 310 |
Try this.
Rgds,
Nimesh Krishnan L
create variable as :
vF_Current_Year
=num(if(month(max(INV_DATE))<4,YearStart(YearStart(max(INV_DATE,-1)),0,4),YearStart(max(INV_DATE),0,4)))
Today = num(max(INV_DATE))
then use following expression for financial YTD:
sum({<INV_DATE={">=$(vF_Current_Year)<=$(Today)"}>}Sales)
I think what you need is RangeSum(Above(...)) function rather than using set analysis. Try this with PER_WD as dimension....
RangeSum(Above(Sum(SALES), 0, RowNo()))
I think this is really close to it perfect now. This is really exciting. How do I limit the days to the max invoice day for the period. Right now I am showing 24 days in the period, but we are in day 8 of sales. The graph is showing days 9 through 24 with same total as day 8. Can you share how to limit the days? Super thank you for the help so far.
May be this
If(Sum(Sales) <> 0, RangeSum(Above(Sum(SALES), 0, RowNo())))
This works!!! Amazing!
Any advice you can give on how best to learn how to write these type of formulas?
The best way to learn is to keep trying out different things. Help others on community and you will get to see different ways to approach the same problem and you will learn. For example, you could have solved the above problem using The As-Of Table approach also, but this requires intervention in the script.
I agree.
The best way to learn is to be active in the community and try to help people as often as you can.