I have a running total and would like to stop it when a condition is matched.
Eg: I have STOCK qty 100pcs; qty is accumulated from Purchase Order Receiving transactions as below:
No. Qty Accumulate
1. 20 20
2. 30 50
3. 10 60
4. 40 100
5. 20 120
The running total should stop at no. 4, because it has reached the STOCK qty 100.
How can this be done?
I'm not sure I understand perfectly what you would like to achieve.
The running total cannot "stop". The running total evaluates by the rules set by you at the time you create the running total. If I remember well you have four options.
evaluate for each record
on change of a field
change of a group
formula
If we assume that you wanted to reset the running total after every 100 then you need to evaluate for each record (1).
For reset you have again four options:
never
on change of a field
change of a group
formula
Here you could write a formula (4) to check for the amount and reset every time when the counter reaches 100.
Related
I'm trying to show the best unit count over a 15 minute rolling interval at a specific level of detail (PLC & Point) that will act as a KPI. I think I'm on the right path but I'm currently getting the "an aggregate function is already an aggregation" error and I can't find either a better solution to do the calculation or a work around for the error.
I have created a calculated field to work out the rolling 15 min sum of the counts called 'Rolling 15 mins' and display that alongside each minute of the test window (see screenshot and 'sheet 1' of the Google drive doc) using
WINDOW_SUM(SUM([Unit Count]),-15,0)
Rolling 15 min screenshot / sheet 1
With the calculation 'Rolling 15 Mins' I've tried to show the best or Max rolling 15mins count at the PLC & Point level so that each points best 15 minute count over a test period is clearly visable using an LOD but this is where I'm getting the error, which I now know is due to the heiracrhy of Tableau calculations, but I can't figure another work around.
{ FIXED [PLC New],[PLC & Point (Test Windows)],DATEPART('hour', [Time]),DATEPART('minute', [Time]) : MAX([Rolling 15 Mins]) }
The screenshot from 'sheet 2' below the 'Rolling 15 Mins' is currently displaying the sum of the unit counts of the last 15 PLC points, but this is the level that I would like to display the best / MAX 15mins unit count over the test period.
The level I'd like to display the MAX 15 mins at / sheet 2
Any assistance with this would be much apperciated. Thanks in advance.
Link to Example File (.twbx)
I am trying to create an excel sheet that calculates average cases per hour based off of start time, end time, and total case count of the order. Ex. Employee A takes a 200 cs order at 0700 and completes by 0745. Employee B takes a 350 case order at 0715 and completes at 0920. Is it possible to create a spreadsheet with formulas that will calculate after entering the required data?
Looking for the pick rates per order, then would like to average on an 8 hour day per each employee.
I am new to SSRS .
I need to get the Max check number , check date for the largest amount for year wise account.
I used sub query to get the max amount and check number. but I am not able get the largest check number in the ssrs grand total.
I need the report as like below,
ex:
2018 SALES
NUMBER OF CHECKS |AMOUNT
4 $25,639.23
TOTAL AMOUNT $25,639.23
LARGEST AMOUNT $7,659.89
LARGEST CHECK NUM 958785576
CHECK DATE 9/9/2018
2019 MARKETING
NUMBER OF CHECKS |AMOUNT
7 $12,455
TOTAL AMOUNT $12,455
LARGEST AMOUNT $5,364
LARGEST CHECK NUM 958786878
CHECK DATE 6/24/2019
Thanks for helping to get the above report.
I usually do this by using the ROW_NUMBER function in SQL Server to identify the record with the highest check amount.
SELECT BLAH, BLAAH...,
ROW_NUMBER()OVER(ORDER BY AMOUNT DESC) as ROW_NUM
FROM TABLE
The ROW_NUMBER will ORDER the checks by AMOUNT in descending order, making 1 the highest amount.
Your largest check would be the one where ROW_NUM = 1. To show the check number in the TOTAL line:
=MAX(IIF(Fields!ROW_NUM.Value = 1, Fields!CHECK_NUM.Value, NOTHING))
I have a table that has a column with unique call numbers and another column that has seconds between events. I want to do a distinct count of the call numbers if the seconds between events is greater than 0. I do not see any nulls in this column.
I tried to do a simple Running Total, but it is not counting correctly. I only get a 0 or a 1, not a running total.
Running Total
Formula
Thanks in advance, any help is appreciated.
Drug Item Count Total Cost Cost/Item % Total Cost Cumulative % Total Cost
Humalog 10 250 $25.00 6.7% 6.7%
Novolog 5 100 $20.00 2.7% 9.4%
Apidra 20 600 $30.00 16.1% 25.5%
Velosulin 10 800 $80.00 21.5% 47.0%
Lantus 50 1200 $24.00 32.3% 79.3%
Levemir 35 770 $22.00 20.7% 100.0%
I've got a detail band in iReport that successfully calculates cost per item and percent of total cost -- see mock-up above. For percent of total cost, I take $F{cost}/$V{sum_all_costs}. I'm having a little trouble with cumulative percent of total cost, though. I can get a variable that shows cumulative sum:
Name: RUNNING_SUM
Calculation: Sum
Reset type: Report
Increment type: None
Variable Expression: $F{cost}
Evaluation Time: Now <-- when the variable is used in the detail band
Any thoughts on how I can take this cumulative sum and get cumulative percentage?
Showing the running total is simple (as you demonstrated in the question). The problem with a running percentage is that you need to know the total first. As you point out, conceptually you need to evaluate the denominator later. But there's no way to specify that.
When I did this in the past I did it like this: Treat your entire current report as a subreport. The only change needed in the report is to add a parameter called $P{GrandTotal}. Then create a brand new report that re-uses the same query. It calculates the GrandTotal and passes it to the subreport. The master report doesn't really need any display elements at all. Now that the subreport has the total as a parameter you can do your running percentage as $F{RUNNING_SUM} / $P{GrandTotal}.
Note: The main report doesn't really need to run exactly the same query. It will probably make sense to use a modified query which calculates the total in the database. As long as it calculates the total somehow you're all set.