Pivot table sorting by text string - excel

It seems so silly, but I am trying to set up my pivot table, and it doesnt seem to be my strongest side.
The following picture demonstrates what I am after:
... so basically in the data there is a currency string, however it seems as if I cant get this string to be represented in the matix - only in either the row labels or columns labels, which makes the table very unstructured. Is there a way to match the security (row label) with its denominated currency ?
this part of my source table:
... where CCY is the currency column I would like within the pivot table and not as a pivot row or column label.
/ Phillip

Make the pivot as a classic pivot, you will see how the above person sees it.
Classic pivot is your answer of putting in text strings inside pivot. It somehow aligns better.
Right click on pivot --> Pivot table option --> Display --> Check the box which says "Classic Pivot table layout".
Take a backup of the excel copy before you switch to classic pivot. Some say it's irreversible

Include the currency-field in the Pivot table, like this:

This is exactly what I am after #MatsLind however this is what I receive when doing this:
so my question is why is our results different ?

Please let me know if I am totally off, but end goal should preferably be the following image:
.. however with this sorting (1.Security , 2.CCY) I am not allowed to sort the value within the pivot table. If I make the follwing sorting (1.CCY, 2.Security):
then I am allowed to sort the data within the pivot table, but I would prefer the former layout.

Can't add comments due to lack of reputation but this ain't an answer exactly.. Maybe..
From what I see in the below image, it looks like you have the row CCY on top and then security. If you want it like the top image, change the hierarchy.
Go to field list and under rows, drag and place the Security on top of CCY, youre pivot will look like above picture.
But you're speaking of sorting, it looks like the above picture has been sorted with the grand total column.. I didn't follow you completely on the sorting peice..
Edit: I understood the problem now, what values exactly are you trying to sort?

Related

Excel:- Difference b/w pivot value col in multileveled table

My Raw table looks like this.
When I create a Pivot it looks like the below screenshot. I have filtered the type column and not actual and others. Now i want to subtract these two columns and create just one more additional column. Maybe some column will show 0 here as I have created dummy data, Sorry for that
Can somebody please help
You will need to create a calculated field/column
This is a very easy and simple guide to do so here: How to create a Calculated Field in Pivot Table
Because your data set is not complete, I am unable to replicate and provide results.
Please mark answer as 'accepted' if you have found this response meets your requirements.

How to add multiple measures into a pivot table?

I'm quite new to using pivot tables and data models, so I don't even know if what I want to do is possible. I have a pivot table (PivotTable1) and its source (Table 25) and I would like to add a hundred or so measures which are listed in the TableCombinations.
For example, I entered the two first measure in orange, but they are not linked to TableCombination and entering them all one by one would be quite long. Each measure is for a distinct Sum wfn column that sums all other rows multiplied by a coefficient. The TableCombinations table simply states the coefficient to be used for each column. For the first three rows, these are my measure formulas :
sum wf1=1.4*Table25[Sum of wD]+0*Table25[Sum of wL]+0*Table25[Sum of wS]+0*Table25[Sum of wW]+0*Table25[Sum of wWSOUL]
sum wf2=1.25*Table25[Sum of wD]+1.5*Table25[Sum of wL]+1*Table25[Sum of wS]+0*Table25[Sum of wW]+0*Table25[Sum of wWSOUL]
sum wf3=1.25*Table25[Sum of wD]+1.5*Table25[Sum of wL]+0*Table25[Sum of wS]+0.4*Table25[Sum of wW]+0*Table25[Sum of wWSOUL]
...
Two questions :
Is there a way to link the tables so that any change made to TableCombination would then be updated in the pivot table measures?
Is there a way to generate all the of the measures without typing them in one by one.
You should be able to use just one DAX measure to do this, using the CROSSJOIN function.
Don't set up a relationship between the Tables, and drag # to the Columns area of the PivotTable. Then create this Measure:
=SUMx(CROSSJOIN(Table1,Table2),Table1[wD]*Table2[wD]+Table1[wL]*Table2[wL]+Table1[wS]*Table2[wS]+Table1[wW]*Table2[wW]+Table1[wWSOUL]*Table2[wWSOUL])
That should give you the exact answer you need.
Here's how it looks using some sample data:
...and here's the sample data I'm using:
You could certainly use VBA to add measures, and to update them when the Table changes. I might have a crack at writing up an answer along that approach shortly. But here's another way to achieve what you want.
I've previously written some code to slave a Table to a PivotTable, so that any change in the PivotTable's dimensions or placement will be reflected in the shadowing Table's dimensions and placement. This effectively gives us a way to add a calculated field to a PivotTable that can refer to something outside of that PivotTable. If the PivotTable grows, the Calculated Table will grow. If the PivotTable shrinks, the Calculated Table will shrink, and any redundant formulas in it will be deleted.
You can easily use this approach to perform your calculations in a 2nd table alongside your PivotTable, and each column x in that 2nd table could easily reference row x in your 'parameters' table.
See Select Newest Record and Create New Table of Unique Values in Excel

DAX - Display the top 1 count in a calculated column

I have a [Company] column, I have a [Billing day] column in a powerpivot sheet.
A Company can have several different Billing days.
I want to show in a Pivot table, next to the company name, the Billing day with the highest number of occurences.
The tricky part is that the number must appear in a [Calculated Column] that will not be put as a Measure in my Pivot table, but as a Column.
I have reviewed such posts as:
this one or this one.
I have learned much but I am still unable to get the correct values.
Any idea ?
Many thanks
This may not be the best way to get you what I understand you are asking for, but it is a way. I believe it achieves what you want regarding the calculated column.
If I start with this table as Table1:
Then I add a column using this code: MaxByDate = COUNTX(FILTER(FILTER(Table1,Table1[Company]=EARLIER(Table1[Company])),Table1[Billing Day]=EARLIER(Table1[Billing Day])),Table1[Billing Day])
And I add another column using this code: MaxOverall = MAXX(FILTER(Table1,Table1[Company]=EARLIER(Table1[Company])),COUNTX(FILTER(FILTER(Table1,Table1[Company]=EARLIER(Table1[Company])),Table1[Billing Day]=EARLIER(Table1[Billing Day])),Table1[Billing Day]))
Then I add one last column using this code: DateOfMaxOverall = FORMAT(SUMX(FILTER(FILTER(Table1,[Company]=EARLIER([Company])),[MaxByDate]=[MaxOverall]),[Billing Day])/COUNTX(FILTER(FILTER(Table1,[Company]=EARLIER([Company])),[MaxByDate]=[MaxOverall]),[Billing Day]),"m/d/yyyy")
I get this table:
Then if I choose to create a Flattened PivotTable from it (Home tab / PivotTable dropdown arrow button / Flattened PivotTable), and set things up like this:
...and turn off the subtotals and grand totals, I get this:
Which is, I believe, what you requested.
But I think a simpler approach might be this:
Start with the first table (Table1):
And, using that table as is, create a Flattened PivotTable directly. Then set the PivotTable up like this:
...and turn off the subtotals and grand totals, to get this:
...Which you can then filter for the max occurring day for each company:
...to get this:

Understanding Pivot Table Count

I was analyzing some data using Pivot Tables and noticed something strange.
I am attaching below the screenshots for details.
The first image if of the data, I have filtered it for a particular Brewery
The second image is of the rows and values selected in Pivot table
And the third image is of the analysis spit out by excel.
My question is shouldn't the count of category for '(512) Brewing Companybe4` which is the distinct values of category as seen from the second image?
If not then how come I can get the unique count of categories using the pivot table.?
Thanks
one way of doing it is to pull the category field just below Brewery one while keeping Category also in the values
This will help you to have the count you are looking for, one thing that may bother you are th subtotals that will appear for each Brewery, but this can be easy fixed by right clicking on them and select "Remove Subtotal..."
Hope this helps, if not let me know
Kind regards

MS-Access Pivot Chart

Could someone help me to sort and arrange the Pivot Chart in MS-Access please. I could do this easily in MS-Excel, but not in MS- Access. I need a gap in between each Task + Budget in MS- Access chart exactly as in MS- Excel. If you put a blank record in Access table, then sorting becomes an issue. Actually the sorting of X axis is not flexible enough in MS-Access and it simply sorts alphabetically. Thanks
This is one way to implement Sten's solution.
Create another column in the query, and union it with the existing data
Select
Replace(Task," Budget","") as TaskGrp,
Task,
Employee,
Amount
From Table1
Union
Select
Replace(Task," Budget","End") as TaskGrp,
Null,
Null,
Null
From Table1
Where instr(Task,"Budget") > 0
Order By TaskGrp, Task, Employee
Then omit TaskGrp when doing the chart
Yeah, what I mean is add the value of a space. " ". Technically the space will show in the graph but no one will be able to see it. You can have an extra column which doesn't go into the graph for sorting.

Resources