How to combine aggregations in new calculated field? - aggregate

I have a list of customer IDs and calculated an amount owing based on 2 columns (accounts receivable customer). As a customer might appear multiple times in the table, I calculate:
sumOver
(
max
(
{unlock_price} - {total_paid}),
[{unit_number}]
)
Based on how long a customer is owing the amount they are assigned to a class (PAR class).
ifelse ( {days_to_cutoff}<=6, "PAR 0-6", {days_to_cutoff}<=14, "PAR 7-14", {days_to_cutoff}<=30, "PAR 15-30", {days_to_cutoff}<=60, "PAR 30-60", {days_to_cutoff}>60, "PAR>60", "Current")
Now, I can visualise class and individual accounts receivable, see screenshot. What I actually want to get to is a total (SUM) of accounts receivable per class in a new calculated field or, ideally, combining all steps in one.
enter image description here
Whatever I tried results in QS complaining that I am trying to nest aggregations and cant do that.
sumOver ( sum ( {accounts_receivable_customer}), [{unit_number}], [{PAR_class}] )

Related

count distinct idi_counterparty PER campaignId tableau

it's my first time here, I have a question I can't solve.
I need a calculation that allows me to see the amount of id there is per campaignid
count distinct idi_counterparty PER campaignId.
Should take into account all activities (sent/open/click)
both columns contain numbers (because they are id)

How do I filter by more than one measure

I have a Word Cloud visual. The size of my words are determined by my total number of employees. Employees is its own field. Two other fields are FTE and Contract and they add up to my total employees. I want to filter my visual by either FTE or Contract. But when I drag these Measures under Filters and uncheck one, it results in no data displaying.
From your excel snapshot, it looks like you have a column for FTE and Contract. Since all records have a value for each column, if you "uncheck" one of them. All record will be filtered out.
From your question it appears you are trying to size the words based upon the number in either FTE or Contract (not total employees)? If this is the case, I would recommend creating a separate calculated field that toggles between the two fields based on a parameter value.
Ex. Calculated Field 1
IF [parameter] = "FTE"
THEN [FTE]
ELSEIF [parameter] = "Contract"
THEN [Contract]
ELSEIF [parameter] = "Total Employees'
THEN [Total Employees]
END
Ex. Parameter (String), List
Value Display As
FTE FTE
Contract Contract
Total Employees Total Employees

Calculate a balance between 3 totals from different tables in FileMaker

The 2 tables in question:
INV
Expense
The 3 fields in question:
INV_total,
EXP_total,
TAX_total
I need a calculation in a report that shows the difference between the 3 fields, a bit like:
INV_total - TAX_total + EXP_total
However for some reason this relatively simple idea eludes me (certainly in terms of execution :) )
Any help would be appreciated.
I'm relatively new to FMP.
Be... Gentle...
There are many possible answers, depending on what exactly you need and for what for purpose. It's unlikely that you would want to total all invoices and all expenses from all times since the beginning of your solution..
Let's say you want to do this calculation for a specific year. You could have a script find the invoices of the given year, place the invoice and tax totals in variables (using summary fields to get them), move to the expenses table and do the same.
Another way would be to use a third table and get the totals through a relationship based on a date range.
Added:
Here's an expansion of the first option, using a script to get the total of expenses.
These are the fields used in the script:
Expenses:
Date (Date)
Amount (Number)
sTotalAmount (Summary, Total of Amount)
Invoices:
Date (Date)
gTotalExpenses (Number, Global)
The script itself would look something like this (here, we are producing a report for the current year):
Enter Find Mode []
Go to Layout [ Expenses ]
Set Field [ Expenses::Date ; Year ( Get (CurrentDate) ) ]
Perform Find []
Set Field [ Invoices::gTotalExpenses ; Expenses::sTotalAmount ]
Enter Find Mode []
Go to Layout [ Invoices ]
Set Field [ Expenses::Date ; Year ( Get (CurrentDate) ) ]
Perform Find []
Sort Records []
At the end of this script, you should see your report with the global gTotalExpenses field containing the total amount of expenses for the current year.
On a long shot I'm going to assume that the expenses relate to an invoice in this case. So to do this calculation you will be best to use some relational database skills.
Give your invoice a unique ID, the best way to do this is add a field called InvoiceID which is a unique serial number. For this example let's assume you have an invoice with an InvoiceID of 123
Add a field called InvoiceID to your Expense table. Each expense that relates to invoice with InvoiceID of 123 will need InvoiceID set to 123.
Go to the relationship graph and link InvoiceID in your invoice table to InvoiceID in your expenses table drag and drop InvoiceID in the Invoice table to InvoiceID in the expense table.
In the invoice table create a calculation field which is INVTotal - TAXTotal + sum( Expense::EXP_total )

Showing 4 records in a portal from same table

I have a table that contains students' results. These results are generally broken into four types: term1, term2, term3 and term4. So over a year, a student may have up to four records in that table containing his results.
I want to create a layout that contain a portal that will show all the 4 records in a single portal row. Is there any way to do this? Or any workaround?
The reason why I do not want to display the records as four rows in the portal is because there are different subjects and will not be right if each subject occupy four rows and there are many subjects a student may take.
I can think of two ways to approach this, both of which would require a relationship from your Results table occurrence to another table occurrence based on Results, let's call it Results~SameStudentID. (The matching field would the foreign key to the Student table, FK_StudentID = FK_StudentID.)
Create 4 calculation fields in your Results table: Result_1, Result_2, Result_n, etc. The formula to use for each of the calculation (starting from the context of the Results table occurrence) would be:
GetNthRecord ( Results~SameStudentID::Result ; n )
Then, simply include the 4 "Result_n" fields in your portal
Create just one field, Results_1_4, with the following formula:
Substitute ( List ( Results~SameStudentID::Result ) ; ΒΆ ; " " )

SSRS 2008 R2 - Group toggle aggregates

I'm working with a dataset where employee utilization is calculated as (Time Billed to X/Standard Billable hours). As such, to get the total billable percentage for an employee, I can just sum up the percentages billed to each client. However, I also want to be able to see the percentage of time billed by department.
I've currently got my data in a matrix with row groups Department-->Employee-->Client with 1 column group of "time sheet ending date". When I toggle the visibility of the client row group based on the employee row group, I get the correct totals at the client and the employee level. However, when I toggle the visibility of the employee row group based on the department row group, the department row group has the wrong totals. For example, if Department A has employee B with 90% utilization and employee C with 95% utilization, the toggled total at the department level is 185%....However, I am expecting to see 92.5%....any ideas????
You might just need to tweak the expression used to get the department total. I am unsure what expression exactly you used, but it should be of the form:
SUM(epmployeePercentageColumn)/COUNT(employeePercentageColumn)
obviously replace the "employeePercentageColumn" with whatever field or variable or expression that represents each of the employee percentages that come under the particular department.
If your current expression isn't in that form, try and tweak it.
Hope it Helps.