I am trying to create a pivot table and pivot chart in excel 2016 based off of cattle auction data. Data for each auction includes: Head of Cattle, total weight, avg weight, price per lb, and price a head. I am trying to show the avg price per head of particular weights. The trouble is when one transaction is for 30 head # $800 and the next is for 1 # $700 it shows average price of $750. But I want to show the average weight of the 31 cattle at $796 not the average of the transactions # $750. Any ideas?
From what you've laid out in your question, it sounds like you should do some calculations in your data before you pivot it. Basically, make a new column that is [transaction] * [the head of cattle], so in this case the new column values are 24000 and 700, respectively.
From there, you can insert a pivot table and use a custom calculation. While in the pivot table click on 'Options' and then click on "Fields, Items, & Sets". Then set the calculation in the formula bar to your new field divided by head of cattle.
Related
Excel - I have built a pivot table showing the number of projected transactions. I have changed my screenshot to make it a little easier to understand. I have total projected vehicle sales in a pivot table. I have another section of data which shows how many reps we have for each vehicle type. I have set up a relationship between these 2 objects. I want to create a measure (which I can then add to the pivot table) which divides the various numbers by the rep count... In effect I want each number in the cars section divided by 62, each number in the Trucks section divided by 39, and each number in the Motorcycles section divided by 34.
The code I am using is
=[Distinct Count of Opportunities] / LOOKUPVALUE(Table1[Reps], Table1[Vehicle Type]], [Vehicle Type])
To try to simplify, I am just using the 2nd part of the calculation...
=LOOKUPVALUE(Table1[Reps], Table1[Vehicle Type]], [Vehicle Type])
I am getting the error: The value for Vehicle Type cannot be determined. Either Vehicle Type doesn't exist or there is no current row for a column named 'Vehicle Type'.
What am I doing wrong here?
We are loading data from an SSAS model (cube) into an Excel pivot table. The data within the spreadsheet needs to be shown using 2 conditions in OR way, I mean, I have 2 fields coming from the database: Original amount and amendment amount, We need display the information coming from the SSAS cube when original amount <=10.000 OR amendment_amount<=10.000.
I tried to use the normal filters on Excel pivot tables, but it doesn't worked, because filters use AND implicitly to display information, I need OR.
I tried to use the normal filters on Excel pivot tables (value and label filters), but it doesn't worked, because filters use AND implicitly to display information, I need OR.
example:
Code original amount amendment amount
C1 25000 500
C2 2000 18000
C3 14000 9000
C4 12000 10500
Filtering by Original_amount<=10.000 and amendment_amount<=10.000 is noy displaying any records
The result expected is C1,C2 and C3 code records displayed because one og the both conditions is true...
How could I filter for displaying the right data?
Using the example described above, the result expected is C1,C2 and C3 code records displayed because one of both conditions is true...
results expected:
Code original amount amendment amount
C1 25.000 500
C2 2.000 18.000
C3 14.000 9.000
How could I filter for displaying the right data?
Create a calculated measure in the PivotTable which is called Show Row:
IIF(
(
Not(IsEmpty([Measures].[original amount]))
AND [Measures].[original amount] <=10000
)
OR
(
Not(IsEmpty([Measures].[amendment amount]))
AND [Measures].[amendment amount]<=10000
),
1,
Null
)
Then add that calculated measure to your PivotTable and filter to keep only rows where Show Row >= 1.
I have hourly data about sales $ of certain categories (Fruits, snacks etc). I'd like to display the median of daily sales values over a month or an year using the hourly data in the table. So, for each category it needs to sum the hourly values and create a daily value first and then calculate the median
regular pivot does not provide median function. I am familiar with Power pivots but have not used Measures. i tried to create a measure using medianX function, but could not make it work
First, you will need to add a Calendar table to your data model:
Calendar Table Explained
The Calendar table must have fields you want to group your sales by, such as "Year-Month" and "Year-Quarter".
Then, connect the Calendar table to your Sales table via date fields, to get a structure like this:
With this data model in place, create 2 measures ( I will assume your sales table is called "Sales", and calendar table is called "Date"):
Measure 1:
Total Sale = SUM(Sales[Amount])
It will simply calculate sum of sale amounts.
Measure 2:
Median Monthly Sale = MEDIANX( VALUES(Date[Year-Month]), [Total Sale])
This measure will first sum up sales by Year-Month, and then calculate the median of the sums.
To get median sales by a different period, just replace Year-Month with the desired grouping level, for example:
Median Yearly Sale = MEDIANX( VALUES(Date[Year]), [Total Sale])
Ali,
When you create your measure you will want to use the MEDIAN funciton not MEDIANX
The MedianX would be if you were trying to calculate the median value for a column in your table that did not already exist.
For Example, lets say we have Table1 which has two columns Net Revenue and Net Expense. And the following 3 data points exist for each row in the column.
Net Revenue:
Jan-2019 100
Feb-2019 300
Mar-2019 300
Net Expense:
Jan-2019 50
Feb-2019 100
Mar-2019 50
Since we do not have a Net Profit column in the table we could use MEDIANX to specify the table we would like to use then write our expression for the column that doensn't exist. In the example above it would go =MEDIANX(Table1, [Net Revenue] - [Net Expense]. This would create a median measure for NetProfit even though the column itself doesn't exist in our table.
In your case, since you are aggregating a column that already exists you can just stick with =MEDIAN.
If you need more clarification let me know!
Best,
Brett
When displaying prior month sales, I noticed that items with no sales in current month are missing in the Pivot Table output of the data model. However, the grand total sales includes sales of those missing items.
I created a small data model to replicate the issue: 2 tables (1 sales table and 1 calendar table) and it has 1 single DAX formula:
Previous Month Sales:=CALCULATE(sum([Sales]),PREVIOUSMONTH(Sales[Date]))
In the output table, I would have expected 1 more item row for Potatoes, with 0 sales in current month and 31 in previous month.
Is there a way to force-show Potatoes item in the pivot table above when selecting date 24/03/2019? Can this be achieved with DAX formulas?
You need to use the Date field from your Calendar (Date) table, for Time Intelligence to work as you intend:
So change your Previous Month Sales measure to:
Sales Previous Month:=CALCULATE (
SUM ( Sales[Sales] ),
PREVIOUSMONTH ( Calendar[Date] )
)
I'd also recommend creating an Explicit Measure for Sales:
Sales Total:=SUM ( Sales[Sales] )
Now you can recreate your pivot output, using Date field(s) from Calendar in your slicer / filter, and you should get the output you require:
I have a table that has two category columns, a column for number started and a column for number finished. I'd like to roll up by one category column and calculate a percentage finished in a pivot table (rather than array formulae).
Imagine my data looks like this:
Date - School - Starters - Finishers
7/1 USC 100 25
7/1 UCLA 200 50
7/2 USC 250 100
7/2 UCLA 200 100
I want my pivot table to look like this
Date - Finish rate
7/1 25%
7/2 44%
But when I go into Value Field Settings to switch to a calculation, I can't figure how to get the column comparison to happen.
You can create a calculated field that compares two other fields in the "Pivottable Tools" "Analyze" ribbon "Fields, Items, & Sets" button - "Calculated Field". Just build comparison expression in the "Formula" text field of the "Insert Calculated Field" dialogue box.