how to do this Pivot Table parameters - pivot-table

I need to Create a report calculating the percentage of Trucks that are less than 25000 pounds per the Total weight per day.
I do not know how to make the percentages about the total amount of trucks vs the amount of trucks that is underweight. please help.

Related

How can I filter for records whose sum make up X% of the total in Google Data Studio?

I have a data set containing clients and two dimensions: Lifetime and Revenue, e.g.
Client
Lifetime
Revenue
Tesla
7,4
280
Amazon
9,2
450
Disney
2,6
130
Otto
11,8
940
BMW
3,5
170
I am trying to calculate the average lifetime, but instead of calculating the average over all clients, I only want to include the top clients (regarding revenue) whose sum of revenue make up 80% of the total revenue.
When doing this manually the process would be quite clear:
Sort the clients by revenue descending
Calculate the total revenue and thus what 80% of
the total is
Check at which row the running sum of the client's revenue exceeds that 80% and only include the records up to that point
This is what the resulting table would look like:
Client
Lifetime
Revenue
Running Sum of Rev
Otto
11,8
940
940
Amazon
9,2
450
1390
Tesla
7,4
280
1670
BMW
3,5
170
1840
Disney
2,6
130
1970
Since the total revenue is 1970, 80% of that would amount to 1576. Therefore I would want to select the top 3 (Otto, Amazon, Tesla) from the set, because their running sum (1670) is just bigger than the 1576.
Then I could calculate the average lifetime of those three clients only.
I have no idea if this is possible in an automated way in Google Data Studio. Filters can only take absolute values and in datasets/blends the order is also not regarded.
Alternative:
I would already be quite happy with something like including only the top 80% clients from the list of clients sorted by revenue (i.e. the 80% quantile). This would be the top 4 in the example (0.8 * 5 = 4), instead of the top 3 as of the original question, but that seems equally impossible.
Data Set (Google Sheets)
Google Data Studio Report

How to calculate the hourly number of observation?

I need to calculate the hourly number of observations for a data set consists of around 100000 dates. each data-time represents one observation.
For example, I need to calculate the hourly events from 2018-11-25-20-35-00 to 2018-11-27-01-35-00.
Additionally, where there is no event there should be an output of zero.
The sample data set is shown in this figure

Calculated SSAS Measurement using Dimensional Attribute

I am trying to calculate a measure based on an attribute in a dimension I have. Never done this before and keep getting errors so thought I would reach out for help. One of my dimensions is an Items dimension and it holds an attribute called Contribution Cost. I also have a measure on my fact table called Net Sales Amount. If there is no cost on a specific item, I want to calculate a Contribution Margin off a percentage of Net Sales, otherwise I want it to simply take the net sales minus the contribution cost. This is what I wrote but could someone help me?
CREATE MEMBER CURRENTCUBE.[Measures].[Contribution Profit]
AS CASE WHEN SUM([Items].[Contirbution Profit]) = 0 THEN SUM(measures.[Net Sales Amount2]) * .6
ELSE SUM(measures.[Net Sales Amount2]) - SUM([Items].[Contirbution Cost]) END,
FORMAT_STRING = "$#,##0;$#,##0",
VISIBLE = 1 ;

Formula for sales volume in 'N' period

My report layout is linked to a stored procedure in SQL, which returns data regarding inventory from our SAP B1 system. This identifies appropriate Minimum and Maximum stock holding values.
I draw in several fields into calculated fields. A pair of parameter fields input a 'no. of periods' value (such as 6 months) and specify an item group from the list in SAP. I currently get the sum total of items invoiced out, minus the sum total of credited in all the way back to record one in the DB.
I need to be able to get a new sales total which is sum total of items invoiced out minus sum total of credits in, divided by the no. of periods value to get a new average sales value. but I simply can't think about how to go about creating the field.
How can I get the desired behavior?

SSRS BIDS SUMMING A SUM TO PRODUCE A SUM

Please see attached images.
On the light blue row I need total percentages next to the total days.
There are 3 classifications : Project, RFC and Support, each has two sub colums (Days and Total%)
I have included a sum for total days added up which is =Sum(Fields!Days.Value)
I now need the TOTAL percentage for each of the 3 classes
You can add a scope to the SUM to specify which Group to sum.
=Sum(Fields!Days.Value,"classification") for example.

Resources