Unable to Create a Sub-Total in the POWERPIVOT - calculated-columns

I am pretty new with POWERPIVOT tables. I have searched for a bit of time now to resolve my problem but I have been unsuccessful so far. As you can see below, I have created a POWERPIVOT table in Excel 2013 that is composed of two FACT tables, which are based on: 1) a sheet where the clients can insert vote 1 budget entries; and, 2) another sheet where the clients can insert vote 5 budget entries. Also, a few DIMENSION tables have been added to the combination in order to link the Branch names and the expenditure type. Please note that this is only a simple example of what I am trying to produce.
However, my main problem is that I can't add a sub-total that would sum Salary, Operating and Revenues for Vote 1 and Vote 5 separately. What I would like to show is the following:
Please note that I have tried calculated columns and calculated fields at the best of my knowledge but the results are always showing another set of columns for Salary, Operating and Revenues but what I need is just one column that sum the three components so it displays Salary, Operating, Revenues and Sub-Total. Does anyone know how to resolve this problem that I am facing since a long time?
Thanks to gurus.

I would suggest that you start by putting both budgets in the one table and an extra column to designate Vote id., Otherwise I fearyou will need to add a calculated column concatenating the Branch and Expenditure Type in each table, then doing a LOOKUPVALUE from Vote1 on the concatenated column to Vote5 and pull back the value.

Related

Append a column of a few tables into a single bigger column

I'm having a problem while building this sheet and i'm not being able to find a solution.
The problem goes like this:
This is a marketing agency that wants to build quotes for their clients in a more automated and simpler way they do today.
There is a master table that the user must put all products they have to offer and their prices
from this master table, I've created 5 other tables with power query, So they have an user interface to fill the number of products and price adjustments they want to quote. Also some products price depends on the price and quantity of other products. that's why I needed to separate it.
Now I need to bring them back together so I can use it as a source for a pivot table to build their report.
I've tried a few things:
Making them all a joined source for pivot table, but as they don't have any exclusive fields it failed.
They have a different number of columns and rows, so putting them below each other won't work
I've also tried =Table[Total Value]:Table2[Total Value], but they are joined side by side, and I need them one below each other.
I haven't tried VBA, but it's not out of the question.

Excel sheets with scores by same ID of person (Kahoot) - How to extract and summarize scores from several quizzes?

I've used Kahoot in the classroom and have several excel files with scores from quizzes.
Students attended quizzes by using unique IDs. In each file, scores are visible for each ID (but ordered by success on each quiz). There are also some students missing or stating wrong IDs (I'll ignore it).
Now I would like to accumulate all scores for all student IDs in one sheet and summarize them by Student ID.
How can I do that most efficiently?
Any pointer or advice is appreciated.
Thanks,
B.
Here's a high level guide to getting what you want along with a sample in this file.
Step 1 - Combine Files to Sheet with Unified Columns
Objective
The goal here is to:
Combine all of your data from other files to single sheet
Merge the data to be in a single column for each field (i.e. Column A has ID, Column B has score).
No breaks in rows.
No formulas.
To illustrate, I made this fake list based loosely on your
description.
Method
You probably can do this manually, but a macro could also be used. If you expect to do this year over year, you might look into vba to open close files in a folder. However, since that wasn't part of question, you can do copy-paste (better yet make a kid do it!). Just make sure there's only one header for each column, and all of the data records align. Probably should do copy paste value if you have any formulas.
Step 2 - Show Summation
There's a couple ways this could be done. A pivot table is probably the most sensible because you could include each quiz as a column to see the total. You could also use a pivot table to do averages by student etc.
TO make a pivot table, I would recommend going on YouTube and they will do a better job of explaining than me.
On that same file I made as an example, I included some tabs to illustrate the power of pivot tables and a couple graphs.
Hope that helps. If you have specific technical questions on this, you might consider asking separately.

SSAS Calculated member that knows if the user is using the report filter

I am trying to write a calculated member which acts differently depending on whether the user is filtering by that member or has it dragged down as rows or columns on their pivot table (using Excel).
The rules are:
1. If the user is using the date dimensin as a Report Filter in Excel, then the calculated member should get the maximum date out of all dates that they are filtered by.
2. If they have the date dimension as rows on the pivot table, then I need to apply ClosingPeriod and some other logic.
Please try this. The idea came from here.
Basically the dynamic named set represents what's in the report filters. And the EXISTING keyword trims the list of days down to the filter context of the current cell letting you detect say if one month is on rows. Compare counts and you can detect what the user did.
CREATE HIDDEN DYNAMIC SET CURRENTCUBE.SelectedDays as
[Date].[Date].[Date].Members;
CREATE MEMBER CURRENTCUBE.[Measures].[My Calc] as
CASE
WHEN SelectedDays.Count > {existing [Date].[Date].[Date].Members}.Count
THEN Tail({existing [Date].[Date].[Date].Members},1).Item(0).Item(0).Name
WHEN SelectedDays.Count < [Date].[Date].[Date].Members.Count
THEN Tail(SelectedDays,1).Item(0).Item(0).Name
END
Performance is going to not be good. And I suspect users will be confused with the results of your calc. If you want to describe the business scenario more I can maybe recommend a better approach.

DAX Rank by Date

I am Counting on Distinct ID's in a column - this is leading to the sum of the subtotals not equalling the grand total as follows:
What I want to do is rank the Payment Dates in cronological order and select ONLY the highest date to display. In the example above the Grand Total won't change, but the Townville row will not show a Distinct Student Count.
This is a very specific requirement and I'm assuming there's an easy way to do it in DAX - I've tried playing around with both RANKX and MAX but am no closer to solving this.
One last thing - the Rank must be contextual to the Time Filter selected by the user (so if they select 2015 it'd give the second record Rank 1 and the top record wouldn't show. If they select May 2015 it'd give the top record Rank 1 and the second record wouldn't show)
I think this is what you are looking for - I added a calculated column to the PowerPivot model that provides a rank based on the Last Payment Date and the Name of the Student. It will rank the earliest payment for any student as a 1.
The code for the column is as follows:
=RANKX(FILTER(Table1, [Student Name] = EARLIER([Student Name])), [Last Payment Date])
... assuming your table is named "Table1"!
The FILTER is the key that limits the ranking to dates belonging to students with that name only.
Update for Multiple tables
To set up relationships between the tables, go to the "Diagram View" of the model, available in the Home tab of the Power Pivot window.
You can drag fields from one table to the other to create relationships. This will only work if at least one of the fields is unique - it's a good idea to think of the model as a dimensional model, with a tables that acts like a fact and other tables around it that act like dimensions.
From the comment, I would try to get the Payments to act like the fact, and have it link to the Community and Student tables. in this case, you could then have the following code:
=RANKX(FILTER(Table1, Related('Students'[Student Name]) = EARLIER('Students'[Student Name])), [Last Payment Date])
This calculated column would be on your Payments Fact table, and it uses a lookup to a related field.
Note that in this specific case, it would be easier to just run the filter over your Student ID field that is used to lookup the Student name.

Showing unique values in a column along with another value associated with each

I have an Excel table containing transactions of companies. It looks like this:
Customer Phone Item Price
==================================
Company1
Company2
Company1
Company3
Company1
I need to see the unique values of customer column.
The result I want is:
Customer Phone Item Price
==================================
Company1
Company2
Company3
Here is what I tried already:
Remove duplicates: To just get the unique values, I can use the remove duplicates of excel. However, since this is something I will be doing frequently, I would rather not have to make a copy of the table each time in order to delete duplicates.
Pivot table: A pivot table does this job perfectly. My problem here is that I need other column info as well (e.g., the phone number) which I want to appear in the column next to the company. [I haven't yet figured out how to do this in a pivot table (i.e., to show a value as text instead of sum or count etc.)] - This would be the best option for me.
As long as you don't have a super long table where the recalculation will kill you, you could just add a calculated column like this and then filter on value being 1:
=IF(COUNTIF($B$1:B2,"=" & B3) > 0,0,1)
If recalculation is an issue, you can use the same or similar method with VBA except paste static values.
PivotTables are well suited for this kind of stuff, so that'd be my first go-to, but PivotTables are also frustratingly difficult to adapt to uses beyond their envisioned use... so there's a steep decline in their usefulness as you stray from that.
Ultimately, you may want to consider a relational database paradigm, and/or using Access. That's one step up the sophistication ladder towards managing the kind of data you're talking about.

Resources