I have data in a table stored in an Excel file. I linked this table into a PowerPivot Data Model, and from that Data Model I want to create a Pivot in the same Excel file. In this table one column contains split of data into: Budget, Last Year, Prior Forecast, Current Forecast. I want to add this field as Pivot coulmns, but I would like to add additional calc item (like in normal Excel Pivot Table I can add Calculated Item) with calculation: [Current Forecast] - [Prior Forecast]. I checked various pages, forums, etc. and I have not found any guidance on how to add such a calc item to a field in PowerPivot.
My input looks like this:
Sample data:
Category Client Amount
Current Forecast XYZ 600
Current Forecast ABC 1000
Current Forecast DEF 100
Prior Forecast XYZ 500
Prior Forecast ABC 1200
Budget XYZ 800
Budget ABC 900
Budget DEF 100
Last Year XYZ 700
Last Year ABC 500
From this data I want to create a Pivot that would look like this:
Current Prior Last
Client Forecast Forecast Budget Year FoF YoY
XYZ 600 500 800 700 100 -100
ABC 1000 1200 900 500 -200 500
DEF 100 100 100 100
In PowerPivot, I want to add two additional columns, perhaps as calculated items in the Category field:
FoF=[Current Forecast]-[Prior Forecast]
YoY=[Current Forecast]-[Last Year]
On below screenshots it is better visible, what I want to achieve:
I can't add this to my source data as the number of rows between current forecast and prior forecast are not in the same amount and not in the same order (they are extracted from another system)
Guenh, this should be quite straightforward:
Depending on your PowerPivot versions, you either create a new measure from PowerPivot ribbon (Excel 2010 Add-in: New Measure button). In Excel 2013, it was renamed to Calculated Field, still available via PowerPivot ribbon:
Anyway, I downloaded your data and created new measures (= calculated fields) for all of your columns, which was the key. The way your data is structured is not ideal, but it's certainly doable. First you have to sum the amount for each category, so use this simple CALCULATE formula:
-CALCULATE(SUM([Amount]),Table1[Category]="Budget")
What it does is that it sums the amount values, but only for rows have Budget in the Category column. The example above is defined for the Budget category; include the other three categories as well (simply duplicate the formula and change the second parameter in CALCULATE: instead of "Budget", use "Last Year", etc.
Then create your FoF and YoY calculations by simply using already created measures:
If you then add new PivotTable (from PowerPivot window), simply drag Client Name to rows section and all the measures to Values section.
With that, you should get your desired result table as shows below. Here you can download the source file (for Excel 2013).
Hope this helps :)
How to do realize calculated item in PowerPivot, usually it has many columns as KPI need to compare, amount, quantity, COST ect. as below 2. secondly most times the data that you want to put in comparison has to lie in row. Really ache to seek a solution, but seems Dax or PowerPivot has lost the function of calculated item.
Related
Hi I am new to tables can anyone help me how to calculate the difference between two columns in table.
The table looks like this
Area 2016 sales 2017 sales difference
-------- ------------- ------------- ----------
India 5000 4500 -500
I am not able to calculate the difference like this in tableau while in excel is too easy
Can anyone help me
Put dimension for years on the columns, put measure on Text (marks tab)
Right click green meausure pile -> Add table calculation
Select Table Calculation "Difference from", "Table across"
Confirm
Now in 2017 column you'll see the difference between 2017 and 2016 and null in column 2016
To return sales redesign your worksheet like this (you can save sales with triangle calculation by dragging it on measures tab)
worksheet design
I am a graduate intern at a big company and I'm having some trouble with creating a measure in PowerPivot.
I'm quite new with PowerPivot and I need some help. I am the first person to use PowerPivot in this office so I can't ask for help here.
I have a fact table that has basically all journal entries. See next table. All entries are done with a unique ID (serialnumber) for every product
ID DATE ACCOUNT# AMOUNT
110 2010-1-1 900 $1000
There is a dimension table with has all accounts allocated to a specific country and expense or revenue.
ACCOUNT# Expense Country
900 Revenue Germany
And another dimension table to split the dates.
The third dimension table contains product information, but also contains a column with a certain expense (Expense X).
ID Expense X ProductName Productcolour
110 $50 Flower Green
I made sure I made the correct relations between the tables of course. And slicing works in general.
To calculate the margin I need to deduct this expense x from the revenue. I already made a measure that shows total Revenue, that one was easy.
Now I need a measure to show the total for Expense X, related to productID. So I can slice in a pivot table on date and product name etc.
The problem is that I can't use RELATED function because the serial number is used multiple times in the fact table (journal entries can have the same serial number)
And if I use the SUM or CALCULATE function it won't slice properly.
So how can I calculate the total for expense X so it will slice properly?
Check the function RELATEDTABLE.
If you create a dummy dataset I can play around and send you a solution.
I have a Fact table that holds what are more or less, sales goals. The ETL process that populates it, generates 12 "weighted" values into seperate rows, one per month. Each row however, also includes a field that holds the yearly value. I do this with unpivot. This all works. Now Im trying to get at this data in the cube with an SSRS report. The problem seems to be that I can query and see the results that include either the yearly goal values or the monthly, weighted values, but not both in the same set.
[update for fact table details]
My Fact table looks something like this:
FK_Account
FK_User
Target
Projected
GoalYear
FK_DateKey
FK_Dept
MonthlyWeightedTarget
MonthlyWeightedProjected
When I load this fact table via the ETL, I get the date key associated with each monthly value (MonthlyWeightedTarget). That will be 12 seperate records, but each one will have the same yearly value. Im not including next years value as a seperate column, because there are seperate records already associated with that year.
Basically, the users define a set of goals associated with a given year. Then I am applying a "weighting" to generate 12 seperate "monthly" records, which total up to the yearly target goal. Hope this makes sense.
What I need to see is something like this result:
Account Name
YTDgoal
YearGoal
NextYrGoal
I created a calculated member for the NextYrGoal, but now Im not sure I even need it.
What would be a good approach for handling the above (getting the ytd, yearly and next year values) ?
If I was getting at these values with TSQL, I would sum on the monthly values, and just include the associated yearly and next years values, grouping by account, year-goal, next-year-goal
I want to link my Slicers values with DAX expression. What I want is If I select any month & Year from Month & Year Slicer
e.g (March Month & 2013 Year) then it should show table as:
March - May2011 | March-May2012 | March-May2013
Sum Of Games 200 | 300 | 400
Sum Of Assets 150 | 400 | 600
Basically it should calculate values from selected month to (Selected month +3) & selected year to (Selected Year - 3).
So is it possible using Slicer selection dynamically?
I have done this in static way. For reference you can see this link
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/73735550-2a8c-4270-b09c-70c98aec5eb8/grouping-based-on-month-range?forum=sqlkjpowerpivotforexcel
but I want it based on user selection dynamically.
Thanks in Advance!
Rameshwar,
without knowing your table structure, it's a bit difficult to propose "the right" solution.
However, to keep things simple (and speedy), I suggest using OLAP Pivot Table Extension. It allows you to grab selected values on slicer and put them into a regular cell.
This way, you could add just year as columns header, and list the months above them. See this article for more details, it describes a similar scenario:
I am not a big fan of cascaded IFs and using complex SWITCH expressions. They are fine when dealing with small amount of data, but could lead to many difficulties and I would suggest avoiding them whenever possible.
Hope this helps :)
I've searched here and elsewhere on the web and have not found this exact problem/solution.
I'm building an rdlc report using the MS reportViewer - the report I'm creating is based on an existing spreadsheet where the average price across 6 months is calculated individually for each month, then the average of those prices is calculated as the 6 month period average price. Whether I agree with that methodology or if it's correct is irrelevant, I just need to know how to get an rdlc to do this.
For example:
Month Price1 Price2 Delta
May-12 $31.54 $30.03 $1.51
Jun-12 $36.27 $34.60 $1.67
Jul-12 $44.19 $42.00 $2.19
Aug-12 $38.96 $37.06 $1.90
Sep-12 $36.89 $35.08 $1.81
Oct-12 $35.57 $33.97 $1.60
Average $37.24 $35.46 $1.78
(sorry for the lack of a screen snip, I'm new and the system won't let me post an image...)
I've created a tablix that does the monthly averages computation - I use a group in the table to group the 6 months of data by month (and then hide the hourly price data so you only see the month total row) but I'm stuck on how to calculate the bottom row of the table which is the average of each column. (the average of the averages is not the same as the average of all 6 months of prices from the underlying data - that's what I've learned in this process... IOW, that was my first solution :-) )
What I tried to do to get the average of the averages was give the month total cell a name, MonthlyAvgPrice1, then in the bottom row, used this expression:
Avg(reportitems!MonthlyAvgPrice1.Value)
As I kind of expected, this didn't work, when I try to run the report, it gets a build error saying "The Value expression for the textrun 'Price1PeriodAvg.Paragraphs[0].TextRuns[0]' uses an aggregate function on a report item. Aggregate functions can be used only on report items contained in page headers and footers."
Hopfully I've explained this well, does anyone know how to do this?
Thanks!
-JayG
Actually it is not clear from the question that how are you in particular binding the data to the report items, But from the given information what I understand is that you can
Try like this:
Right Click the tablix row and insert a row below
In the cell where you want to have this Average of Averages insert the following expression
=Sum(Fields!Price1.Value)/6
and similarly insert expression =Sum(Fields!Price2.Value)/6 and =Sum(Fields!Delta.Value)/6 in the other cells where you want to display the Averages
Of Course, you will change the Field names Price1,Price2 etc to the fields that you are getting the values from.
HTH