employee utilization in power pivot - excel

I've been strugling with this and searching for an answer for about a week so far..
I got a list of projects with a person responsible, utilization for each project, start and end date. Looks like that:
What I would like to achieve is to get an utilization sum for every single date between project start (in fact min date) and project end (max date), like that:
In pivot table of course.
I tried to work with self-build dynamic calendar but I don't have a clue how to DAX it for every single date...
Please help!

you need to create a table with every single date and then bring that table into the data model. Then use those dates as the column headers. Make sure your dates are in the same format as your table with information. Are you using power pivot in Excel or PowerBI? The steps are similar but easier in PowerBI.

Related

Show active accounts in Excel Pivottable

I am trying to show revenue per month for a number of rental contracts that run for months or even years. Those contracts have a start and end date and I want to show per Month how much is coming for a given year.
This is the source table:
This is what I want it to look like:
Have only managed to do it in an ugly way with an intermediate table but there must be a proper way to do this in a Pivot table, right?
Thx for your help!
Have tried many ways in a pivot chart but using the start and end date as filters is giving me very odd results with only data being shown when a contract starts or ends.

Dax function for same period last year is not working in excel

So I have a data model that I am using for analysis in excel power pivot. One of the tasks is to calculate YTD sales amount. Now for that task I can use combination of CALCULATE, SUM and SAMEPERIODLASTYEAR functions. Only problem is that this is not working when using Power Pivot in Excel but is it working when I am using Power BI. I imported my data model in PBI and tested the same function.
When working in excel measure created with SAMEPERIODLASTYEAR reports an error for contiguous dates but it doesn't happen in PBI.
Does anyone know why is this happening? The problem is that I have to use excel so that is why I am asking this.
Are you using SAMEPERIODLASTYEAR on a Date Column from a non-date table? In that case it won't work because Time Intelligence functions such as SAMEPERIODLASTYEAR require a complete date column as the argument, so I would suggest you create a date table from your Fact table or by creating a custom function in Power Query.
Here is a link for creating a robust date table: https://forum.enterprisedna.co/t/extended-date-table-power-query-m-function/6390
And then use SPLY like this:
Something =
CALCULATE (
[Total Sales],
SAMEPERIODLASTYEAR ( Dates[Date] )
)

Generate a forecast on a Running Sum chart in Tableau

I need to create a forecast chart of a Running Sum of a column in my data. The data comes from and Excel table and is an income value. I have a line chart of the Running Sum of this income over time (year quarters). The data itself is not ordered by date, but by a particular ID that is not used in this chart, and it should not be re-ordered.
The chart looks like this:
If I just use the income, I can create the chart with a forecast. However, if I add the quick calculation for Running Sum, then the forecast stops working because "Forecast can't be added to a view that uses a table calculation".
I tried creating a calculated field that already contains the Running Sum, but Tableau recognizes it as a table calculation too. I also tried creating the Running Sum in the original data (I have access to the Excel file) but since the rows are not ordered by date, the Running Sum doesn't work.
I would like to know if there is an alternative? It can be either using a Tableau workaround or an Excel calculation I am not aware of, that gives me this Running Sum without Tableau identifying it as one.
Thanks in advance.
In the end, I managed to created a Running Rum in the Excel using the following formula:
=SUMIFS(DATABANK!T:T,DATABANK!O:O,CONCAT("<",TEXT(A2,"0")),DATABANK!D:D,"ELC")
Where in column A I have one month date per row, DATABANK-T is the Income, DATABANK-O is the Date and DATABANK-D is a filter (not relevant to the problem).
Then, in Tableau I took the Date as a column (by months) and this Running Sum as a measure, as a SUM.

Calculate average based on a value column (count) in a pivot table

I'm looking a way to add an extra column in a pivot table that that averages the sum of the count for the months ("Count of records" column) within a time period that is selected (currently 2016 - one month, 2017 - full year, 2018 - 5 month). Every month would have the same number based on the year average, needs to be dynamically changing when selecting different period: full year or for example 4 months. I need the column within the pivot table, so it could be used for a future pivot chart.
I can't simply use average as all my records appear only once and I use Count to aggregate those numbers ("Count of records" column).
My current data looks like this:
The final result should look like this:
I assume that it somehow can be done with the help of "calculated filed" option but I couldn't make it work now.
Greatly appreciate any help!
Using the DataModel (built in to Excel 2013 and later) you can write really cool formulas inside PivotTables called Measures that can do this kind of thing. Take the example below:
As you can see, the Cust Count & Average field gives a count of transactions by month but also gives the average of those monthly readings for the subtotal lines (i.e. the 2017 Total and 2018 Total lines) using the below DAX formula:
=AVERAGEX(SUMMARIZE(Table1,[Customer (Month)],"x",COUNTA(Table1[Customer])),[x])
That just says "Summarize this table by count of the customer field by month, call the resulting summarization field 'x', and then give me the average of that field x".
Because DAX measures are executed within the context of the PivotTable, you get the count that you want for months, and you get the average that you want for the yearly subtotals.
Hard to explain, but demonstrates that DAX can certainly do this for you.
See my answer at the following link for an example of how to add data to the DataModel and how to subsequently write measures:
Using the Excel SMALL function with filtering criteria AND ignoring zeros
I also recommend grabbing yourself a book called Supercharge Excel when you learn to write DAX by Matt Allington, and perhaps even taking his awesome online course, because it covers this kind of thing very well, and will save you significant head-scratching compared to going it alone.

query in a powerpivot table to do a group by

I have a table called "purchase" with the following data:
year month time day_week name provider service purchase revenue
I am using this data to make a pivot table. Then I have another table called "active":
name provider service description month year number_active
I used this data to create a separate pivot table.
Now I need a third pivot table with something like:
number_active/revenue
and slice it vertically to by year. The problem is that I cannot create a relationship between the table because in Purchase I have the services by day and hour and in Active I have the services by month. I think I need to create another table that is a view of Purchase grouped by month.
I tried the following :
home -> From Database -> From analysis services or PowerPivot
But i have a error:
I'm not sure where to go from here.
How can I make this view grouped by month?
I don't think you need to create a new view of summarized data as a source. You just need to be able to summarize by date, and you can do this by adding a date dimension.
You can download one for free from the Windows Azure marketplace.
Once you have your date table, add a calculated column to the Active table in your Power Pivot model called Date that is =[Month]&"/01/"&[year]. Then change the data type to date.
Then do the same thing to your Purchase table. Next, create relationships from Active[Date] to Date[DateKey] and from Purchase[Date] to Date[DateKey].
You could make all of this go down to the time level and related it there instead (Power Pivot will assume midnight if you don't specify a time in your date column). But I'm simplifying since that is not needed for this one scenario.
Next make your two base calculated measures
Number Active:=Sum(Active[number_active])
Total Revenue:=Sum(Purchase[revenue])
I'm not sure what your number active means, so I'm assuming it is just a sum. You can adjust this calc if this is not the case.
Then make your final calculation: Revenue Per Active User:= [Number Active]/[Total Revenue]
Then you should be able to pull month and year into a pivot table along with this new calculated measure and your original measures (number active and revenue).

Resources