I have a spreadsheet in Mac1 Numbers2 that tracks amounts due and amounts paid, ordered by date.
Transaction Date
Customer Name
Amount Due
Amount Paid
...
...
...
...
16 Nov 2022
Name1
$70.00
$70.00
16 Nov 2022
Name2
$70.00
$0.00
16 Nov 2022
Name3
$0.00
$70.00
16 Nov 2022
Name2
$0.00
$70.00
...
...
...
...
I would like to add an additional column, Running Total, that shows for each transaction, the accumulated credit/amount due for that row's customer up to that row's date.
Transaction Date
Customer Name
Amount Due
Amount Paid
Running Total
...
...
...
...
...
16 Nov 2022
Name1
$70.00
$70.00
$0.00
16 Nov 2022
Name2
$70.00
$0.00
-$70.00
16 Nov 2022
Name3
$0.00
$70.00
$70.00
16 Nov 2022
Name2
$0.00
$70.00
$0.00
...
...
...
...
...
I have a separate sheet that shows the complete running sum for each customer from the beginning of time through the present, but I'm at a loss for how to create a row-by-row, grouped running sum (or even whether Numbers allows for it).
I have tried to create formulas with SUMIF, but have not made headway in understanding how to code the kind of filter I need, so have not even created a runnable test formula. Various Google searches for creating running sums by group/category in Numbers, Excel, and GoogleSheets have not yielded results.
In a database, this would be trivial, but I'm restricted to Numbers.
1 MacOS Monterey 12.5
2 Numbers 12.2
Related
I'm looking for a way to calculate recurring revenue over time in a time plot where the X-axis is the date and Y-axis is the total amount of revenue (sum). The question we're trying to answer is "At any given point in time, what is the total amount of revenue coming in?"
Every line in the source data has an account name, subscription type (new, renewal, expansion), annual subscription amount, service start date, and service end date.
[Sample of data below]
Account
Type
Subscription Amount
Service Start
Service End
001
New
$ 1000
Jan 1, 2020
Dec 31, 2021
002
New
$ 2000
Feb 1, 2020
Jan 31, 2021
003
New
$ 3000
Apr 1, 2020
Mar 1, 2022
001
Expansion
$ 500
May 1, 2020
Dec 31, 2021
002
Renewal
$ 2500
Feb 1, 2021
Jan 31, 2023
004
New
$ 1000
Mar 1, 2021
Feb 28, 2023
002
Expansion
$ 250
Jun 1, 2021
Jan 31, 2023
001
Renewal
$ 1500
Jan 1, 2022
Dec 31, 2023
The main issue I'm running into is that when using either running sum or "cumulative" under the time plot settings panel, the total will continue running on the X-axis regardless of the service end date. This is a problem for situations like Account 002, which renews Feb 1st, 2021. Data Studio would (incorrectly) show an amount of $4500 for that account starting on Feb 1st -- where I want it to show only $2500 at that time.
Comparing what the data should be showing at any point in time vs. what actually happens:
Date
Amount I want to see
What is currently calculated
Jan 1, 2020
$ 1000
$ 1000
Feb 1, 2020
$ 3000
$ 3000
Apr 1, 2020
$ 6000
$ 6000
May 1, 2020
$ 6500
$ 6500
Feb 1, 2021
$ 7000
$ 9000
Mar 1, 2021
$ 8000
$ 10,000
Jun 1, 2021
$ 8250
$ 10,250
Jan 1, 2022
$ 8250
$ 11,750
Jan 1, 2023
$ 5250
$ 11,750
Is there a way to achieve this?
Ideally, the most elegant solution seems to be to tell the plot to only sum between dates (i.e. sum if "reported x-axis date" is between Service Start date and Service End date), but I don't know how to reference the X-axis value in a formula.
I have not yet tried blending the data but I'm thinking that may be another path forward as well?
Any help on this would be much appreciated!
This might be a strange question... but will try to explain the best i can ...
BTW : There is no chance in implementing through Stored Procedures... it should be made in SQL Query only ... But if the only option is SP, then i have to adapt to that ...
I have a table with the following elements :
RUN
WORKORDER
LOCATION
TRAVELTIME
NUMEQUIP
TOT_TIME
NO99
1
Start
NO99
2
Customer 1
112
1
8
NO99
3
Customer 2
18
11
88
NO99
4
Customer 3
22
93
744
NO99
5
Customer 4
34
3
24
I need to add a running DATE and HOUR by calculating the amount of time it takes from one line tho another BUT, and this is important, to take into consideration working hours ( from 9:00 to 13:00 and from 14:00 to 18:00 ( in US format : from 9am to 1pm, and 2pm to 6pm)... As example ... considering that my start date and time would be 10/May/2022 9:00 :
RUN
WORKORDER
LOCATION
TRAVELTIME
NUMEQUIP
TOT_TIME
DATE
TIME
NO99
1
Start
10/05/22
9:00
NO99
2
Customer 1
112
1
8
10/05/22
10:52
NO99
3
Customer 2
18
11
88
10/05/22
11:18
NO99
4
Customer 3
22
93
744
10/05/22
14:08
NO99
5
Customer 4
34
3
24
12/05/22
10:06
This result is achieved by calculating the estimated time to make the trip between customers (TRAVELTIME), and after arriving is also added the time spent on maintenance (TOT_TIME that is Number of Equipments (NUMEQUIP) vs 8 minutes per equipment)... By this, and since customer 3 will have 744 minutes (12 h and 58 minutes) in maintenance... and those minutes will spawn through 3 days, the result should be as shown...
With the following query i can have almost the desired effect... but cannot take into account only work hours ... and all time is continuous...
Select
RUN,WORKORDER,LOCATION,TRAVELTIME,
DateAdd(mi,temprunningtime-TOT_TIME,'9:00') As TIME,
NUMEQUIP,NUMEQUIP*8 AS TOT_TIME,sum(MYTABLE.TRAVELTIME +
MYTABLE.TOT_TIME) OVER (ORDER BY MYTABLE.ORDER) AS temprunningtime
FROM MYTABLE
With this query (slightly altered) i get an running TIME, but does not take into account the 13:00-14:00 stop, and the 18:00-9:00 stop...
It might be a bit confusing but any ideias on this would be very appreciated... and i will try to explain anyway i can...
I have students data for their fees paid for each program, now I want to show the outstanding fees, now since it's possible student could have their outstanding fees for 2018, 2019 and 2020 pending, hence it will have 3 rows (The months will be in columns). Now since the student is same, I will be clubbing the records in the front end, now if I consider pagination and I have 10 per page limit, and in these 10 records 3 records is of the same student (since year was different), in that case I will end up having just 7 records on given page.
Here's the sample data.
Studentname RollNo Year Program Jan Feb Mar Apr May Jun ...
abc 1 2018 p1 200 50 10 30 88 29
abc 1 2019 p1 100 10 20 50 12 22
abc 1 2020 p1 30 77 33 27 99 100
xyz 2 2020 p2 88 29 32 99 199 200
How could I manage pagination for above case.
Assuming your front end is HTML/CSS/Javascript:
You don't need to handle pagination in your query - or even your backend - at all. Everything can and should be done on your frontend. I would suggest using JQuery and Bootstrap to create a paginated table to display your data using Material Design for Bootstrap
This question is about how to clean up the time data.
I am doing a database migration.
Old system:
For the time column, I have values such as:
9:30am - 12.30pm
9.30am - 12.30pm
9:30am-12.30pm
3pm to 7pm
3-9pm
1900-2000
1900h-2000h
etc etc...
New System:
Start time | End Time
0930 | 1230
0930 | 1230
0930 | 1230
1500 | 1900
1500 | 2100
1900 | 2000
1900 | 2000
Problem: How to efficiently convert the OLD values into NEW system where there are two columns with start and end time? (Or must I do it manually? The database has over 10000 records)
Although the data is of inconsistent format it looks quite easy to convert to the required format, mostly with a series of simple find/replace. For example in this order (or equivalent):
to > -
. > :
space > nothing
a > spacea
p > spacep
h > nothing
It is already more consistent:
9:30 am-12:30 pm
9:30 am-12:30 pm
9:30 am-12:30 pm
3 pm-7 pm
3-9 pm
1900-2000
1900-2000
Using Excel's Text to Columns with - as the delimited would then get to (in separate text columns):
9:30 am 12:30 pm
9:30 am 12:30 pm
9:30 am 12:30 pm
3 pm 7 pm
3 9 pm
1900 2000
1900 2000
Entering 1 somewhere in the spreadsheet and copying that cell before selecting cells containing M (with Find All and Ctrl+A) and then Paste Special, Multiply would coerce the selection into Time for formatting as as hhmm, to give:
0930 1230
0930 1230
0930 1230
1500 1900
3 2100
1900 2000
1900 2000
The likes of 3 would need some manual intervention (to guess whether AM or PM) but once that was addressed export as .csv should provide data ready for insertion.
I have a Reporting Services report which shows a bunch of KPI scores. Each KPI has it's own Row on the report and for each row we show the SUM or AVG (depending on KPI type) score for last 3 years, and then a SUM, AVG or (ideally) total YTD figure per month in the current year:
KPI 2009 2010 2011 Jan Feb Mar Apr May etc.
Bagels Eaten (Total) 100 90 70 10 20 9 13 14
Sandwiches (Cumm. YTD) 90 75 86 13 23 46 65 76
The problem I'm seeing is that the RunningValue function appears to be working across rows, instead of within the filtered column group and current row that makes up the Jan, Feb, Mar columns (monthly data, grouped by year and month, filtered on current year). So the output is not as above, instead its a fairly random figure based on all the values in the rows (I'm sure it's not random it just looks like it is).
The Column Group is called "MonthNum" and the Expression for the cell value decides which aggregation to apply based on an "AggregationType" value in the source data:
=Switch(Fields!AggregationType.Value="SUM", Sum(Fields!ScoreValue.Value),
Fields!AggregationType.Value="AVG", Avg(Fields!ScoreValue.Value),
Fields!AggregationType.Value="YTD",
RunningValue(Fields!ScoreValue.Value,Sum,"MonthNum"))
Any help much appreciated
Update:
Here is an example few rows (scores per month, per kpi) of the data set being used (formatting is a bit tricky!). Items with aggragation type 'YTD' would have the cummulative YTD expression applied, everything else would be SUM for the current month:
KpiID Title KPIOwner ScoreValue YearNum MonthNum ReportingGroupTitle ScoreType DisplayOrder DisplayPrecision UnitOfMeasure AggregationType
5 Donuts Served Donut Manager 35 2007 1 Catering Services Actual 10020 0 Number YTD
5 Donuts Served Donut Manager 42 2007 2 Catering Services Actual 10020 0 Number YTD
5 Donuts Served Donut Manager 86 2007 3 Catering Services Actual 10020 0 Number YTD
5 Donuts Served Donut Manager 14 2007 4 Catering Services Actual 10020 0 Number YTD
6 Donuts Cooked Donut Manager 45 2007 1 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 48 2007 2 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 93 2007 3 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 32 2007 4 Catering Services Actual 10020 0 Number SUM
6 Donuts Cooked Donut Manager 18 2007 5 Catering Services Actual 10020 0 Number SUM
From what I understand from your question this is what I would do:
Assuming that when the aggregation type YTD returns the acumulated totals until (and including) the MonthNum.
Create a Matrix with two a groups on KpiID and a child group on AggregationType, and two column groups (adjacent) one on the year and one on the month (on the year group, create a filter so that you don't include the current year and on the month group exclude the values where the year is not the current one).
Then you can use the following expression, for both the year and the month group (the last will give you the YTD value for the last month in each year)
=Switch(Fields!AggregationType.Value="SUM", Sum(Fields!ScoreValue.Value),
Fields!AggregationType.Value="AVG", Avg(Fields!ScoreValue.Value),
Fields!AggregationType.Value="YTD", Last(Fields!ScoreValue.Value))