Grand total on a SSAS driven pivot table - excel

We are using a SASS SSAS driven pilot table where we would like to add a calculated measure using the sum of a column.
We don't know in advance which filters the users will be using, the measure is valid for any of them, so we just tried adding a calc measure on the excel file such as
[Measures].[Sales]/sum(axis(1),[Measures].[Sales])
But it doesn't seem to work. So just to test we started with a plain
sum(axis(1),[Measures].[Sales])
which gives some astonishing result.
We cannot figure out what the result is adding up! Applying some filters and a detailed row, we get exactly twice the expected value (!!??).
Applying exactly the same filters and filtering also the rows, we get a value that we are not able to guess where it comes from.
Any idea about what MDX should we use?
Edited to clarify: We want to add the calculated measure on an Excel pivot table, not on the SSAS olap cube definition.

I obviously was having a bad day. One cannot think excel-like to solve an mdx issue.
A simple
([MyDim].[MyHierarchy].currentmember.parent,[Measures].[Sales])
is the right syntax to use in our calculus as the "parent total".
Thks

Related

PowerPivot table relationship not working, repeating totals

Longtime answer-seeker, first time question-asker here so I'm open to feedback about how I'm asking as well. I'm relatively new to Excel's PowerPivot but feel like I have a handle on it for the most part.
I am using PowerPivot for Excel 2010. I have data that I only receive weekly totals for and I use the monday of that week as my primary key in the table I call 'WeeklyTracking'. I create a relationship from that to my Date Table so that I can filter/analyze by month, year, etc. I get no error when I make that relationship, it is a one to many ( I checked for duplicates in my WeeklyTracking table), and it is showing as 'active'.
However, when I go to create a pivot table it's not separating the data by my Date Table fields. It simply repeats the total for the column. What my pivot table shows me. Table Relationships
I tired disconnecting all other table relationships, and I even tried converting dates to numeric values and linking those but to no avail. When I choose to make column labels the date within the 'WeeklyTracking' table it separates out by date just fine which leads me to believe it has to do with the relationship. But I did something very similar with data I get monthly and didn't have any problems so I can't figure out what's different.
Any ideas?
EDIT: It's actually not working for my monthly report either, upon closer inspection. But still I dont understand why not--There's a primary key in each table...
UPDATE: Tried creating a ID number using a formula for each week and creating the relationship on that and it didn't work either.

Pivot table sorting by text string

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?

Avoid DISTINCTCOUNT in PowerPivot

Due to performance issues I need to remove a few distinct counts on my DAX. However, I have a particular scenario and I can't figure out how to do it.
As example, let's say one or more restaurants can be hired at one or more feasts and prepare one or more menus (see data below).
I want a PowerPivot table that shows in how many feasts each restaurant was present (see table below). I achieved this by using distinctcount.
Why not precalculating this on Power Query? The real data I have is a bit more complex (more ID columns) and in order to be able to pivot the data I would have to calculate thousands of possible combinations.
I tried adding to my model a Feast dimensional table (on the example this would only be 1 column of 2 rows). I was hoping to use that relationship to be able to make a straight count, but I haven't been able to come up with the right DAX to do so.
You could use COUNTROWS() combined with VALUES().
Specifically, COUNTROWS() will give you the count of rows in a table. That means COUNTROWS is expecting a table is input. Here's the magic part: VALUES() will return a table as results, and the table it returns are the distinct values in the table/column that you provide as the argument for VALUES().
I'm not sure if I'm explaining it well, so for the sample data you provided, the measure would look like this (assuming the table is named Table1):
Unique Feasts:=COUNTROWS(VALUES('Table1'[Feast Id]))
You can then create a pivot table from Powerpivot, and drag Restaurant Id into Rows, and drag the measure above into Values. Same result as DISTINCTCOUNT, but with less performance overhead (I think).

What does the SSAS setting None in AggregateFunction do?

As I understand Microsoft's explanation setting the AggregateFunction of a measure to "None" should null out the value unless you are viewing the data at the lowest possible level. (i.e. the data element is a copy of the value in one exact cell in the cube).
I've created a fact table at the grain product id and sales date, and have set AggregateFunction property of a few measures (they are percentages of some sort) to "None", and I nulls at every level in the cube, even the product/sales date level (I am using Excel to connect to the cube and drilling through a pivot table).
I'm sure that there is something simple that I am missing, but I don't quite see what.
When Aggregate Function of a Measure is set to 'None', SSAS does not calculate the measure for the 'All' member in any dimension. Put in other words, we will have only leaf-level values for measures and that too only for dimensions that are directly linked to that fact.
You can find more elaborate explanation in this post.

PowerPivot to list data values instead of summarising

Just starting with MS PowerPivot. I am trying to create a pivot showing the list of responses to questions in a survey, but am falling over where the powerpivot wants a 'Summarize by' value for the pivoted responses.
In a sql query to return these data I would use max(AnswerComment) (as there will only be one answer per respondent per question). However, when I select Max as the Summarize by values, PowerPivot returns: ERROR - CALCULATION ABORTED: Calculation error in measure 'Answer'[Maximum of AnswerComment]' and then explains that only numbers or dates (and not Strings) can be 'MAX'ed.
Is there a way of listing pivoted data (rather than performing a summary calculation on it)? If not, is there a summary function that PowerPivot accepts for string types?
thx
mcalex
By definition, PowerPivot doesn't let you list text values out. The way to workaround this is to place the column onto a row and then make sure you have another measure that includes all values of that column (traditionally dimension).
Saying this, a common approach is to build a Power View report on top of your PowerPivot workbook. This will allow you to list the values.

Resources