Crystal report - Trouble finding the right formula - stored-procedures

I am working with this report and I'm having a hard time finding the formula for this scenario.I want the payment amount to be distributed in school fees and fills the fee with the least amount first below is the current report I've created.
I have this stored procedure that gets the fees above and the payments below is in the details section of the crystal report.
Here is a clear example:
The initial payment is 500
The least fees is internet fee with the amount of 376.20
500-376.20 = 123.80
so the remaining 123.80 will be going to the other fee which is 752.40
752.40 - 123.80 = 628.60(remaining balance of the other fee)
What I want to know is there a possible way to do this
What formula do I use to produce such output below.

You have to create two formula fields, Formula1 and Formula2,
In Formula1 add this operation :
Formula = Ammount - InternetFee
In Formula2 add this operation :
Formula = OtherFee - Formula1
you can drag drop formula1 into formula2 from report fields in formula tool bar

Related

How to generate a distribution based bar chart on row_numbers

I have a SQL query that acts as a data source in my tableau desktop:
SELECT
row_number() over (order by sales) as rn,
article_number,
country,
SUM(sold_items) as si,
SUM(sales) as sales
FROM data.sales
WHERE sales.order_date between '2021-01-01' and '2021-12-31'
GROUP BY 2, 3
On tableau I dragged rn to column and sales to row to generate a bar chart. The following is the output:
I want to convert this into a 0-100% distribution chart so that I can get the following result:
How can I achieve this? Also, I want the user to filter by country level so even if the # of records increase or decrease, the distribution should always be consistent with the filtered data.
You can do this with nested table calcs.
For example, the following uses the Superstore sample data set, and then first computes a running total of SUM(Sales) per day, then converts that to a percent of total. Notice the edit table calc dialog box - applying two back to back calculations in this case.
The x-axis in this example is Order-Date, and in your question, the the x-axis is a percentage somehow - so its not exactly what you requested but still shows that table calcs are an easy way to do these types of operations.
Also, realize you can just connect to the sales table directly, the custom sql isn’t adding any value, and in fact can defeat query optimizations that Tableau normally makes.
The tableau help docs explains table calculations. Pay attention to the discussion on partitioning and addressing.

what's the best way to unpivot a data to create a structured data base in google sheets

The best approach to understand what i need is taking a look at the sample spreadsheet
https://docs.google.com/spreadsheets/d/1AyqCMvbjUt3nlqvE2ZLbmPfixwh_i1nIl9HMTn4pETY/edit?usp=sharing
What i need is unpivot the data:
1st date payment
xx months depending on the months entered in Col G (here i need to round the amount of the monthly payments, and in the last payment adjust the amount, so i don't get cents in the monthly payments divided)
last date payment
i believe the best way is generate a data base ordered correctly, from there know in which date every client has a due date for his payment
The way im entering the data is as the sample sheet shows from A:J
And my expected result is in range L:P
any help on this please will be very much appreciated
This is probably best handled by breaking the problem in 2 parts. Monthly payments and First/Last Payments. I've laid out one possible solution on your sheet in a tab called MK.Idea.
I used a SPLIT(FLATTEN( technique to generate both sets of cashflows and then a simple query to stack and order them.
This formula generated the monthly flows:
=ARRAYFORMULA(QUERY(SPLIT(FLATTEN('S1'!A2:A&"|"&'S1'!B2:B&"|"&MROUND(('S1'!D2:D-'S1'!E2:E-'S1'!I2:I)/'S1'!G2:G,100)&"|"&EDATE('S1'!H2:H,SEQUENCE(1,MAX('S1'!G2:G),0))&"|"&EDATE('S1'!H2:H,'S1'!G2:G)&"|"&"Monthly "&SEQUENCE(1,MAX('S1'!G2:G),1)),"|",0,0),"select Col4,Col1,Col2,Col6,Col3 where Col4<Col5"))

Income Statement Subtotals In Tableau Worksheet

Sample Data
First, I am trying to create your basic multi-level income statement.
Gross Sales
Discounts
Net Sales
COGS
Gross Profit
and so on. I have tried turning on subtotals for all columns. I have searched for an answer for days now, but the one example on the Tableau forum has SUM(Amount) only. It has various different groups; covering the income statement categories. This example has a grouping of groups. I can mimic this, but it gets me no closer to, for example, calculating gross profit (net sales minus cost of sales). For presentation purposes, all of the values need to be positive, except of course if there is negative gross profit; e.g., a loss. Therefore, for some subtotals I am subtracting one subtotal from another. I am relatively new to Tableau and I am at a dead end since I don't know where to turn. My data sheet is simply an Excel workbook with transaction date, account, product, product category, and amount.

how to pivot balance amount in google sheet

I am using this formula in I5 =G5-SUMIF($A$5:A5,A5,$K$5:K5) to calculate the outstanding amount which is getting 0 once all the fee is paid, then I am pivoting the data to compare the course Fee vs Outstanding amount as shown in the below pivot screen shot:
As per the calculation I want to compare the fee amount received vs remaining balance in the pivot of a respective reg no. If the final balance is 0 it should show in the pivot instead of adding the course outstanding entries.
Please help me out.
Sample worksheet : https://docs.google.com/spreadsheets/d/1roEXEuBBwHU8lKV_QruY6hVjYOOkpwAwAI5x8yuYfZ8/edit#gid=339420405
Solution:
Since the balance goes down every time a payment is made every row, you can use MIN of Course Outstanding Amount Rs on the PivotTable values to show the final balance:

What Google Sheet function can i use to Calculate Cash on Hand?

I have a google sheet which is like a register where I keep all purchases for a business. I have purchases made with different types of methods. I would like to specifically be able to track the amount of cash on hand at all times. I have a sheet I have created that already calculates other stuff by formulas. Here is a Public link to a demo version:
https://docs.google.com/spreadsheets/d/1mArgTCpxYajmk2bOkE3aIaDTevajYxvsQW5P2cJbb8k/edit?usp=sharing
What I need exactly is a formula that will subtract cash purchases from the on hand balance calculated by adding the Replenishment column then subtracting from the Costs field but only if its a cash purchased item.
=IF(D4:D="Cash"),=Sum(L4:L) - Sum(F4:F)
Cash on hand to reflect actual amount and deduct cost amount of cash purchases.
Why anyone would want the result escapes me but, where the row contains Cash in ColumnD:
=sumif(D:D,"Cash",L:L)-sumif(D:D,"Cash",F:F)
will add the ColumnL values and subtract the ColumnF ones.
=sum(L:L)-sumif(D:D,"Cash",F:F)
would seem to make a little more sense.

Resources