I use Google sheet to record my revenue for months, but recently I have some trouble.
I offer both post-paid and prepaid service, so I have some customers prepaid for more than one month, while post-paid service would be charged each month because it's usage-based. In short, I have to distinguish prepaid and postpaid service, and the billing date, then sum the total amount I need to bill my customers.
I used to use the formula that simply multiply the prepaid service amount of the first month by payment cycle (how many months he prepaid), but recently it starts to go wrong because the amount would be different in each month.
I do search for some articles about sum the dynamic range, but soonly find it hard to use because I have to select my column conditionally, and even with mutiple columns to sum.
The sample of my sheet:
https://docs.google.com/spreadsheets/d/1x0-1ckpoCB6XZJOqkEYZzoqUP49F-tdisrMXKbxZ4kk/edit?usp=sharing
So the problem is: How to sum with the conditional dynamic range for my prepaid services? Please do not hesitate to give me some suggetion on my sheet. Thank you!
try:
=INDEX(LAMBDA(d, h, aa, bi, cr, e, MAP(A2:A7, B2:B7, C2:C7,
LAMBDA(a, b, c, IFERROR(IF((b="1st")+(NOT(ISERROR(SEARCH(TEXT(e, "M/D"), b)))), SUM(
IFERROR(FILTER(FILTER(d, h>=EOMONTH(e, 0)+1, h<(EOMONTH(e, c)+1)), aa=a, OFFSET(aa,,1)=bi, FILTER(d, h=cr)=0)),
IFERROR(FILTER(FILTER(d, h<e, h>=(EOMONTH(e, -c-1)+1)), aa=a, OFFSET(aa,,1)=bi, FILTER(d, h=cr)=1))),
SUM(FILTER(FILTER(d, h<e, h>(EOMONTH(e, -c+1)+1)), aa=a, OFFSET(aa,,1)=bi, FILTER(d, h=cr)=1))), "no match"))))
('My raw data'!C$2:$15, 'My raw data'!C$1:$1, 'My raw data'!A$2:A$15, "Billing", "Criterian", B8))
Related
I have a Union table of my various bank accounts to create a personal finance analysis dashboard.
I am trying to make a Running Total to show my total capital available at any given date. Using a Running Total table calculation works, just as much as using a RUNNING_SUM() calculated field. They both work up until I filter the dates. So I am trying to find a way to make the running calculation work without being thrown off by Date Filters (I would like to implement relative dates for visualisation in the dashboard).
My union table has the following relevant data columns:
Order ID: Descending number from 1 for each entry per account.
Date: Date of entry.
Item: Entry name.
Account: Name of bank account.
Amount: +ive for credit or -ive for debit.
Balance: balance after entry value for each given account.
So the table can look like this:
So on 07/05/2019 the Running total should be 229.64.
The running sum formula mentioned above is currently RUNNING_SUM(SUM([Amount])), so if any dates are excluded via filter the running total doesn't add up to the right amount.
A way I can see around the problem could be to get the sum over all accounts of the last balance reading at a given date. The balance is a running total but only if the final entry per time period for all accounts are summed would it work. Would it be possible to make a calculated field that gets the last balance reading for each account at any given date and then sums them?
Or is there a simpler smarter way I am not aware of?
This comes down to an Order of Operations problem. Once you filter the dates the viz doesn't have access to the data anymore.
Your best approach would be to add the running sum to the data source before you bring it into Tableau. Then the running sum isn't a calculated field dependent on the data in the Viz.
I have a formula which calculates the commission earned by a salesperson. We store our invoices under each salesperson, so it's easy to separate them. I need a way to summarize this formula, and I can't use either a running total or a summary because each customer has a different commission rate per pound sold. Currently, the formula to calculate what rate the commission should be applied something like this:
if {cust.custnum} = "101010" then .0250*sum(#metal lbs, {invoice.invoicenum})
else if etc.
where {#metal lbs} is a formula that has to be used as an intermediary to get the weight of the metal on the invoice, and looks like this:
IF {INVOICELINEDETAIL.GLCode} = "METAL " THEN
{INVOICELINE.Wt}
ELSE
0
Sorry for the lengthy post, but I'm trying to give as many pertinent details as possible.
If you group by customer and then also group by invoice number then you could put your summary in the customer footer, would that work for you?
Another thought is I believe in running total you can set a formula for the evaluation so maybe you could use the nested if there and achieve what you need?
My income statement requires a column for each department in our business. Each of my six departments have their own Sales, Cost of Sales, Gross Profit, Overhead, and Net Income.
The view from the database contains columns for GL Number, Department Number, and Amount for every transaction. I can tell if its Sales, Cost of Sales, etc from the identifying GL Number. I am able to get all of the pertinent information from one view, however I don't know how to arrange it on the report.
I created an initial version in Excel using the Sumifs function. How can I get the same arrangement of data in Crystal Reports?
Running Totals can be configured to only count records that meet given criteria. When creating the RT, select "sum" as the type of summary and "Use a Formula". In the "x-2" screen, write logic to filter out anything that doesn't meet the criteria you want.
Simple way would be group by report by GLNumber and place all fields that required sum in details and insert summary in group footer.
I need a way to work around Crystal's inability to summarize a summary.
Data Sample:
Shipment Number and Sum of $ Paid:
shipment #1 $1089.34; shipment#2 $985.22; and shipment #3 $1002.87
I have grouped my data by Shipment Number and summed the $ Paid for each shipment. Different deliveries were on each shipment so I had to sum the $ Paid to get the total amount paid on each shipment. Out of this list of sums, I need to find the median. I know this would be easy to do if I exported to excel, but I need to have it built into the Crystal Report.
I know writing a simple formula such as median(sum($paid)) does not work. The error message "this field cannot be summarized" confirms that Crystal does not have the ability to summarize a summary.
Please help! Any work-arounds are greatly appreciated.
You can achive this by using Running total.
Take running total for paid and another running total for count then use both in a formula to find the median.
I am a beginner in iReport and I cant program Java so I hope you can give me an idea.
I've already managed to make a chart that displays how often all customers have ordered in february, march,... etc.
Thats how I did it:
In category expression I have: $F{Month}
In value expression I have : $F{count(Orders)}
But I want to display how often only one customer (for example customer a) has ordered in february, march,... etc.
I have the following values which i can use:
Month, Orders and Customers(here are all customer names saved)
-------//-----------UPDATE--------------//-----------------------------------
I want to display a chart which represents the total orders per month of a customer. But iam trying to display my 3 customers (my database has only 3) in only one chart (stacked).
For example(see picture above): I want to display the total orders from Customer A (yellow) in february. And I want to display the total orders from Customer B (blue) in february and the same for customer C.
The customers should be displayed stacked (3 in every month) and every customer should have a different color plus the total orders from every customer should be displayed ...like in picture above for example:
customer A(yellow) made 3 total orders in february, Customer B(blue) made 2 total orders in february, customer C..etc.
it is very important that every month displays 3 customers...stacked.
How do I do this?
I appreciate every idea.
From what I have understood from your question, you want to show a chart which represents the total orders per month of a customer.
You need not use stacked bar graph for this purpose.
You may want to use bar graph which would serve your purpose.
If you want to see the chart per customer, create one parameter $P{customer} and pass it into your query.
Refer document iReport-Ultimate-Guide-3 on how to create parameters and to use it in queries.
e.g:
select customer,month,count(orders)
from <your table>
where customer=$P{customer}
group by month
The above approach would work if you want to see the details for only one customer.
**Here is my solution after your update.**
From your update, it seems like you want to represent the total orders per month for all the customers.And you want to use stacked chart for the same.
Then what you have done is correct but have missed to add a field to your 'Series Expression'
Add your field customer to your series expression and this will resolve your problem i.e,
Series Expression : $F{customer}
Category expression : $F{Month}
Value expression : $F{count(Orders)}
This will display the chart in the format you have specified.
Create a paramter that takes your customer name $P{customerName}
and another takes month $P{month}
pass these two paramters to your sql like that
SELECT customer_name, order_count FROM customers
bla.. bla..
WHERE customer_name=$P{customerName} and month=$P{month}
then create a chart with only one serie to show one customer as one color. Not like yours with 3 colors.
Fell free to ask for more specific detail.