Display Value from PowerPivot FieldList - powerpivot

I want to show a value in a cell of Excel which is coming from PowerPivot Field List.
How to show its value in Cell?

You have a couple of options to show a value from a Power Pivot model in a cell in Excel.
1) Create a pivot table with only the values for the field that you want. You can do this by opening your Power Pivot model and clicking Pivot Table on the home tab. Locate the field you want and put it in the Rows. You can remove the grand total by going to the design tab in the PivotTable Tools group and choosing Grand Totals -> Off for Rows and Columns. You can type your own heading in the row that says row labels.
2) Use a slicer. Add a pivot table, then click Slicer on the Insert tab. Select the field you want to show and click OK. You can delete the rest of the pivot table if you don't need it.
3) Use cube functions. You can get a list of values for a certain dimension by creating a set and then cuberanked members. For example, I have a Power Pivot model with a field called cities. My cube set is in cell G1.
=CUBESET("ThisWorkbookDataModel","[Location].[City].[All].children", "Cities")
In the cells in column G below G1, I can copy the following cuberankedmember formula.
=IFERROR(CUBERANKEDMEMBER("ThisWorkbookDataModel",$G$1,ROW()-1),"")
This gets the list of members from the set in cell G1 and lists out the member in order. so you need to copy that to as many cells as there are values. I used ROW()-1 to create an autonumbered list that starts with 1. So in cell G4, I'm saying "get me the 3rd city. Since the number of members can change, I added the IFERROR. Normally, if you ask it for more members than are present, it will return #N/A. IfError catches that error and returns a blank string instead (this is purely for cosmetic purposes and can be left out).
You can see the results of the 3 options below.

Related

how to bing the grouped items to a non group section of a tablix

I need to have a graph the same size as tablix. Since i cant merge the cells , how can i bring the grouped items to the left ?
i have this
Before
and i want it to look like this:
After
But since the period is a group i cant merge the cells in the bottom, So is there a way to bring period colums to the left.
Thanks
If your chart and table use the same dataset (and why wouldn;t it if it showing the same data), you can put them in a list that will grow with the column grouping of your current table.
INSERT a new List. A list is really just a table.
Add an extra row to the list in the same group.
Set the Grouping on the list to Group By 1 (the number one). This will group everything to one line.
Set the dataset to the same dataset as your chart and table.
Set the list's top cell's size to match your table.
Put the table in the top row.
Set the bottom cell to the height of the chart.
Put the chart in the bottom.
The column grouping in the top will stretch out the list and the chart will go with it.

Find number of rows in an already filtered Column A in Excel

I have got an Excel spreadsheet. This spreadsheet has just one tab in it. The Tab name is dynamic in nature and changes every week also the number of rows.
I have column A filtered already with a VBA macro. A1 has the header.
Now, I wanna find how many rows are there in this already filtered column A.
I am looking for any VBA function.
I have tried using Subtotal function.
=Subtotal(103,A2:A1345)
But I don't know the end range. As of now the end range is A1345. It will change every time in future if the new rows are added.
I tried multiple things but those did not work. I am quite new to VBA.
If A1 will never be blank, you could use (in a column other than A)
=Subtotal(103,A:A)-1.
Or, if there will be data below your table not to be counted, then format your table as a Table and use structured references (and this formula could go into column A)
=SUBTOTAL(103,Table1[column_header])
You can put the formula in column A if you use another column's last populated cell as the demarcation point.
If column B contains numbers then,
=subtotal(103, a2:index(a:a, match(1e99, b:b)))
If column B contains text then,
=subtotal(103, a2:index(a:a, match("zzz", b:b)))

Excel Autofilter, Copy selection, Paste to new sheet

I have a table with source data in columns Regions!A6:R553.
In Regions!A3:R3, I have formulas that pull specific information out of my data table in Regions!A6:R553 that I want copied to a different sheet.
Column A acts as my project name column, while column B holds ID numbers. In my case, there are multiple ID numbers per project.
I am looking for a script to filter and loop through all the unique order numbers in Column B one by one, then copy cells A3:R3 to RegionsSummary!A12:R12 for as many rows as there are unique order numbers (i.e, add rows to the table).
Here is a screengrab of my data sheet, "Regions":
i.stack.imgur.com/aTPuw.png
Here is a screengrab of the empty template sheet "RegionsSummary":
i.stack.imgur.com/9Ukz5.png
Example: Assume there are 5 projects in my data sheet. I will filter the data using another macro to select Project_1. I would then like a command button to active a macro that will filter to the first order number in Column B, copy Regions!A3:R3 to RegionsSummary!A12:R12, then filter to the second order number in Project_1, and repeat the process. This should go on until all unique ID numbers have been filtered and looped through.
Here is a screengrab of what a final product should look like:
i.stack.imgur.com/9Ukz5.png
Here is a link to the file: Final Output Example
I would go with an easier solution than a Macro with certain constraints. I am not able to access your sheet, so I will make a sample excel.
STEPS:
Create a list of unique projects for a dropdown (COPY Regions!A5:A10000 to a new sheet > Data > Remove Duplicates) . Create the dropdown (Data Validation > List > Select Range) using Data Validation in "Example_Result" sheet- C7.
In "Regions", in Col S, put the below formula
=S6&"_"&COUNTIF($S$6:S6,S6)
Copy this formula down for the entire sheet or as long as you expect the sheet to grow
In "Example_Result", insert an index column (1 to 1000, in Col A if you expect each project to have 1000 or less order numbers) from A12 onwards.
Along the columns (B onwards) of Row 11 include the names of the variables from Regions (Assessment Project, Highway etc).
Insert the below formula in B12 to S1000 (depending on number of variables) of Example_Result:
=IFERROR(INDEX(Regions!$A$5:$S$10000,MATCH($C$7&"_"&A$12,Regions!$S$5:$S$10000,0),MATCH(B$11,Regions!$A$5:$H$5,0)),"")

Macro or method to pivot data in Excel?

I am looking for a way to dynamically pivot data in an Excel sheet to put the data in a universal format no matter how wide the data set is.
For example: I want to be able to take a spreadsheet that could have 5 columns, 30 columns, or x number of columns to make it pivot to a universal format that is only three columns wide.
Here is a sample of how the original data could look:
I want it to look like this:
Is there a way to do it, either by macro or using any other Excel functions?
Assumes labels/data is in Sheet1 starting A1.
Insert a new ColumnA.
For Excel 2003: Activate any cell in your summary table and choose Data - PivotTable and PivotChart Report:
For later versions access the Wizard with Alt+D, P:
Select Multiple consolidation ranges and PivotTable and click Next >.
In “Step 2a of 3”, choose I will create the page fields and click Next >.
In “Step 2b of 3” (not shown in the modal!) specify your summary table range in the Range: field (A2:E6 for the sample data) and click Add, then Next >.
In “Step 3 of 3”, select a location for the PivotTable (the existing sheet should serve, as the PT is only required temporarily):
Click Finish to create the PivotTable:
Drill down (ie double-click) on the intersect of the Grand Totals (here Cell L4 or 16):
The PT may now be deleted.
In A2 of Table:
="Summary"&RIGHT(B2)
Convert the resulting Table into a conventional array of cells by selecting Table in the Quick Menu (right-click in the Table) and Convert to Range.
In a spare column starting in Row2 series fill integers down, from 1 to however many rows of data you started with (4, in the example). Then series fill that series to suit.
Sort sheet by that (spare) column, Smallest to Largest, with My data has headers checked.
Delete Row1 and spare column and hopefully you will end up with:

Dynamic reference in excel formula

I have the following array formula which works for what I want to do but I'm trying to change the formula when a user selects a value.
=INDEX($A$2:$B$70,SMALL(IF($A$2:$B$70=$A$121,ROW($A$2:$B$70)),ROW(1:1))-1,1)
It's used for a monthly report and the user will choose from a drop down the day of the month, e.g 1,2,3 - 31.
So if the user selects 1 from the drop down menu I want the formula to use the above formula.
If they select 2 for example I want the formula to move over a column so it would change to
=INDEX($A$2:$C$70,SMALL(IF($A$2:$C$70=$A$121,ROW($A$2:$C$70)),ROW(1:1))-1,1)
and so on moving over a column at a time.
It this possible at all or can it even be done without VBA?
I have an example of what I want done on the following link
https://docs.google.com/spreadsheets/d/1MDOzoQxYLgW-UOyljZsMwSu8zyAB7O2k1V-bTNP5_F0/edit?usp=sharing
All the data is on the first tab called staff. Each employee has a row and the duty assigned under the corresponding day column.
On the Roster tab it summarises each day. So what I am trying to get to happen is when you choose the day of the month (or preferably the actual date) the sheet changes to reflect the data.
At the moment the code I have working does for just Day 1 because the column references are coded into the formula. I was hoping to somehow choose 6 for example from the drop down and then the formula will map chosen day to the corresponding range in the raw data and update the formula and change the formula from Staff!$A$2:$B$68 to Staff!$A$2:$G$68.
If the formula finds no more entries if shows #NUM! but I intended to use the function ISERROR() to replace #NUM! with "".
This is what I'm trying to achieve it if makes sense?
There are a few issues here/ You are returning the value from column A so the first range can be $A$2:$A$70 and that means you don't need the 1 to specify the column_num. The IF statement was covering A2:C70 when you really only want either B2:70 or C2:C70 depending on the 1 or 2.
Assuming that A122 has either a 1 or 2 in it then,
=INDEX($A$2:$A$70, SMALL(IF(INDEX($B$2:$C$70, 0, $A$122) = $A$121, ROW($1:$69)), ROW(1:1)))
Standard non-array alternative,
=INDEX($A$2:$A$70, SMALL(INDEX(ROW($1:$69)+(INDEX($B$2:$C$70, 0, $A$122) <> $A$121)*1E+99,, ), ROW(1:1)))