I would like to calculate rolling YTD for previous year in Spotfire Cross Table.
Example: I have YTD for this year (Jan-Jul 2019), so I need to calculate YTD for Jan-Jul 2018.
I've already calculated YTD for previous year, but the formula works just one month and then I have to adjust it manually again.
Sum(If(([Date]>=Max(DateAdd("mm",-17,[Date]))) and ([Date] <=Max(DateAdd("mm",-12,[Date]))),[Sales]))
Could you please give me some advice how to build the formula so I don't have to adjust it every month?
Thank you very much.
This should achieve what you want, if I understood it well :
Sum(If(([Date]>=Date(Year([Date]) - 1,1,1)) and ([Date]<=Max(DateAdd("mm",-12,[Date]))),[Sales]))
It takes the sum of sales from the 1st of january of previous year until the current day and month of data of previous year.
Related
Assume my Dec'2020 revenue is 1000. My total 2021 revenue forecast is 15000.
I turned this into a monthly revenue increase evenly distributing the growth.
I set every month equals to their previous month PLUS a number(currently blank) throughout the 2021.
Then I have a SUM() formula to total every month of 2021.
I would then use goal seek to set the SUM to 15000 and change the value of the "number".
Results look like this
This has produced the desire result.
However, I am wondering if there's a faster way to do this? I would need this in a formula that I can simply drag over and get the results.
I have tried PMT formula with no luck.
Not sure if I understand what you after correctly, but here is my attempt:
Suppose you have the following named ranges:
Rev_Fcst being the forecast revenue for the next year which is 15,000 in your example;
Rev_Mth0 being the starting revenue of Month zero which is 1,000 in your case;
Rev_Growth being a dollar value of monthly revenue growth, and in your assumption this figure is fixed across the 12 months.
Suppose your data is in Column A:M being the 13 months from Dec-2020 to Dec-2021,
Use this formula to calculate Rev_Growth:
=(Rev_Fcst-Rev_Mth0*COLUMNS($A$1:$M$1))/SUMPRODUCT(ROW($1:$12))
Suppose the revenue of Month Zero Dec-2020 is in Cell A2, then in Cell B2 enter the following formula, then drag it across all the way to Month Dec-2021.
=A2+Rev_Growth
See below demonstration:
Let me know if you have any questions. Cheers :)
I am very new to DAX and i want sum of sales for the previous months. As you can see, the dates are : The 15th of every month and the last day of every month. Can anyone please help me?
I want when i use the date as a filters , when i chose a date, i want the measure to give me the results of the previous date.
Have you tried making a calculated column that shows the "previous date" for each date. If that is successful then possibly you could return the result using the date from the "previous date" calculated column when the row with a date was selected.
OK. Thanks for posting this. Working on it has been very instructive. I've attached a copy of my power bi file and a pdf
this may not be a solution you can use... it does show both amounts received during the month and the total for the month (months are displayed as numbers)
The core trick I used was to create 2 calculated columns for each row, one for the 15th the other for the end of the month. I populated them with a zero or the amount in the row depending on what the date field in the row looked like. that gave me amounts i could summarize.
https://drive.google.com/file/d/1hdM5QKonEft4sYk2yyD0JLlXJcEb3baU/view?usp=sharing
I have an issue here. I want to calculate the week nummber of first sunday of business year. Where I work their calendar starts on February 1st. To calculate i have a column A2 in excel which has the date in mm/dd/yyyy format. I want to generate the corresponding fiscal week for the column.
example of my result set:
for 2/1/15 the week of year number should be 1
For 2/7/16 the week number of year should be 1
I tried the below formula, but its starting the week from the first day of the fiscal year and not the first sunday of the year.
=INT((A1-WEEKDAY(E9165)-DATE(YEAR(A1+7-WEEKDAY(A1))-(MONTH(A1)<2),2,1))/7)+2
Please help...
-Sandra
Assuming that your work years always start on the first sunday after February 1st:
=IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))
We first determine the week number of the date starting from the first Sunday of February. To do this I have used WEEKNUM()-WEEKNUM(02/01/SAMEYEAR) taking 1 day from the date to force week 1 as Excel begins counting from week 0 by default. Using IF() we state that if the outcome is 0 or less then add the result to 52, which will give us the correct result for dates in January as they produce negative values.
Edit - Very long formula but gives you the week of the quarter in Q1 W1 format:
=SUBSTITUTE(CONCATENATE("Q",INT(IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))/13)+(IF(INT(IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))-INT((IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))/13))*13)=0,0,1))," W",INT(IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))-INT((IF(WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1)<=0,52+WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1),WEEKNUM(A1)-WEEKNUM(DATE(YEAR(A1),2,1)-1))/13))*13)),"W0","W1")
Apologies for the length, I tried multiple methods to try to find a neater solution, but this was all that I could get to work. It would be a lot neater if there were multiple columns used.
Use this formula:
=IF(A1>=IF(WEEKDAY(DATE(YEAR(A1),2,1),1)=1,DATE(YEAR(A1),2,1),DATE(YEAR(A1),2,7-WEEKDAY(DATE(YEAR(A1),2,1),1)+2)),ROUNDUP((A1-IF(WEEKDAY(DATE(YEAR(A1),2,1),1)=1,DATE(YEAR(A1),2,1),DATE(YEAR(A1),2,7-WEEKDAY(DATE(YEAR(A1),2,1),1)+2))+1)/7,0),ROUNDUP((A1-IF(WEEKDAY(DATE(YEAR(A1),2,1),1)=1,DATE(YEAR(A1)-1,2,1),DATE(YEAR(A1)-1,2,7-WEEKDAY(DATE(YEAR(A1)-1,2,1),1)+2))+1)/7,0))
Way late to the party but was looking for the answer and found this thread. Ended up play around with the function myself and it's much easier to just deduct the dates; =WEEKNUM("date"- days you wish to offset)
Ex; If cell A1 holds my date, 2/1/2021 I wish to convert; =WEEKNUM(A1-31) result "1".
To create a monthly budget in Google Sheets, biweekly pay needs to be calculated. Some months there are three paydays and some there are two. Paydays are every second Wednesday night.
The below formula worked previously, and now it does not.
Before being rounded, the formula calculates to =ROUNDDOWN(1.14)*1000 which multiplies the pay amount by one except there is never only one payday in a month. This month there are two pay days, 14/09/16 and 28/09/16.
=ROUNDDOWN((EOMONTH(TODAY(),0)-(MOD(DATE(2016,8,31)-DATE(YEAR(TODAY()),MONTH(TODAY()),1),14)+DATE(YEAR(TODAY()),MONTH(TODAY()),1)))/14)*1000
Where is the error in my formula?
Consider this formula:
=(INT((EOMONTH(TODAY(),0)-DATE(2016,8,31))/14)-INT((EOMONTH(TODAY(),-1)-DATE(2016,8,31))/14))*1000
It calculates all the paydays from the end of the current month back to your date of 8/31/2016 and subtracts all the paydays from the prior month back to the same date.
In march of 2017 it will give the correct 3 paydays.
Using excel, is it possible to specify the month to report in a cell?
For example, excel would need to report the latest reported sales, if its available. If the month of February sales is not available, then it will report January sales. Likewise, if March sales is available, it would report the sales in March.
How do you write this formulae in a cell in excel? If its not possible to write such a formuale, can we write a vba to do this?
If you mean you have a list of sales entries and want the sales for the last month in the data, you could write one formula to get the latest month. If months are in A you could write: =month(max(A1:A99999))
Note if you have multiple years data, you need to pull the year too or get bounding dates. You can then sum sales using an array formula like assuming the result of the first action is in D1 and sales are in B: {=sum(if(month(A1:A999999)=D1,B1:B999999,0))}
If you have incremental updates during the month, this will return month to date data. If you need data for the last full month, you can use another array formula to get the maximum month where the date is the last day of the month.
If the cells for future data in B1:B12 are blank then you just need to extract the last number in B1:B12 don't you? If so then try
=LOOKUP(9.99E+307,B1:B12)
You can use the OFFSET function to select specific data based on the month.
Insert a formula to calculate the current month (or just type in the month number)
=MONTH(TODAY())
The formula to select the current months of sales data
=SUM(OFFSET(B1,MONTH(TODAY()),0,1,1))
Have a look at the help in Excel on the OFFSET function. It can be used to select a range of data. For example, to return data from the start of the year to the current month the formula would be:
=SUM(OFFSET(B1,1,0,MONTH(TODAY()),1))
If the current month does not contain data yet, you can test to see if a value is returned and revert to the prior month if there is no data.
=IF(SUM(OFFSET(B1,B16,0,1,1))=0,SUM(OFFSET(B1,B16-1,0,1,1),SUM(OFFSET(B1,B16,0,1,1))))
I found this answer:
=IF(B12<>0,B12,IF(B11<>0,B11,IF(B10<>0,B10,IF(B9<>0,B9,IF(B8<>0,B8,IF(B7<>0,B7,IF(B6<>0,B6,IF(B5<>0,B5,IF(B4<>0,B4,IF(B3<>0,B3,IF(B2<>0,B2,IF(B1<>0,B1,0))))))))))))
This formulae solves the problem of picking up the latest available data.