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.
Related
I'm new to Tableau and new to posting in Stackoverflow so bear with me.
I have a dataset with variables such as State, County, Organization, 2020 Enrollment, 2021 Enrollment, and Delta (change in enrollment over those two years). What I want is a column that gives the percent delta in enrollment over these two years.
The first thing I tried was calculating a column just using the growth formula:
(ZN([2021Enrolled])-ZN([2020Enrolled]))/ZN([2020Enrolled])
In the Data View this works great, because nothing is being summed, I get the correct delta. But when I use this formula in my worksheet, what happens is that the formula is being calculated across all the observations (there are several observations per county, per organization, for example) and then summed up. This gives an incorrect delta for year over year.
What I am looking for is a way to calculate the % delta column based on the total enrollments for 2020 and 2021 in order to achieve the correct % delta.
I included two screenshots below showing what Tableau is giving, and then an Excel spreadsheet of the same data filtered on just one county to show the problem a little better.
Maybe a similar question has been asked before, but I was unsure just how to search this up. Any help would be appreciated.
Thanks!
Sam
Tableau view
Excel view
I found the answer: I was trying to create a calculated column in Data View, what I needed to do was create a calculated column in my worksheet view, so that it would only work on the data presented there.
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.
Currently i had a project using Microsoft SQL Server Analysis Service. I found a problem regarding filtering data with excel timeline.
Here is my date dimension screenshot:
<img src="https://i.stack.imgur.com/NUr2x.png"/><img src="https://i.stack.imgur.com/5OSgA.png" />
I had a cube with 2 measures, Sales Quantity (measures) and Sales Quantity Last Year (calculation). Here is MDX expression for Sales Quantity Last Year calculation:
( ParallelPeriod([Date].[YM].[Calendar Year],1,[Date].[YM].CurrentMember),[Measures].[Sales Quantity In 1000] )
After deploying the project to my local server, the data can be shown perfectly using excel 2013:
Pic: Data in Excel without filter
The problem start when i want to filter the data using excel timeline. When i filter only '2016', my calculation measure is no longer working. You can see the data in 'Sales Quantity in 1000 LY' column is blank. It looks like that i cant see the data outside current filter (2016). Pic: Filtered using timeline filter
But when i use slicer, the data can be shown normally Pic:Filtered using Slicer
Did i make a mistake in building date dimension? Or i need to fix the MDX calculation query? Because when i test this case in Microsoft AdventureWorksDW2014 with the same date hierarchy and the same calculation, all is going well.
Your parallel period calculation looks correct assuming [Date].[YM] is your date hierarchy. I am guessing that your date dimension is off somehow.
Make sure that:
it has a hierarchy created, and the hierarchy is what you are referencing in the parallel period calculation. Here is an example, you could have more or less attributes in the hierarchy obviously.
Your attribute relationships are defined correctly.
Key columns on the attributes in the hierarchy are correct. In the example above, you would just make year the key for the year column, but then for quarter it would be a collection of the year and quarter column. For period, key columns would be year, quarter, period. For week, key columns would be year, quarter, period, week. Date would just use the date column since date is the key.
4.Make sure that the date key attribute is using a date field for it's value column, as a time slicer needs this.
define time intelligence on your date dimension. Right click on the date dimension on the solution explorer and choose add business intelligence, then on choose enhancement screen pick define dimension intelligence. Then set the attribute type for each dimension attribute. Here is how it would be for our example.
Hopefully one of these does it for you.
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.
So I started using Pivot Tables a few weeks ago, but I'm pretty decent at Excel otherwise. I hit an issue that should be an easy fix and I don't see it. I have a document that is tracking Key Performance Indicators for my warehouse packing department. I have 2 tabs in the document that matter (Input Log, and Analysis).
Input log is basically copied from a report generated from my warehouse system. Gives me a USER, DATE, HRS WORKED, ORDERS PACKED, ITEMS PACKED. Using a pivot table I want to see the average hours worked by week for each user.
Currently I can only see the Sum of the hours works and the daily average. How do I also see the weekly average?
[InputLogData][2]
I was able to get the workbook hosted on google drive Packing KPI Workbook
If you create the pivot table, but select to "add to data model",
you will see, in the "Value Fields Settings" selection, a Distinct Count item.
You can then do a Distinct Count of the WE column, and add a column to divide the total hours worked by User, by the total number of Weeks. (See the formula in D4: =B4/C4 )
EDIT: If you want to have the results within the Pivot Table itself, you can add a few calculated columns to your input log.
WE per User is the Unique number of weeks each user works. This formula is an array formula and must be entered by holding down ctrl + shift while hitting enter. Excel will place braces {...} around the formula seen in the formula bar:
=SUM(--(FREQUENCY(IF(User=D2,WE),WE)>0))
Hrs Worked This Wk is the hours worked in the week by the user. This is not really needed, but is in there for when I was troubleshooting the calculations.
=SUMIFS(Hrs_Worked,WE,A2,User,D2)
This will be used to calculate the average for the AvgHrs/Wk column:
=SUMPRODUCT((User='Input Log'!$D2)*Hrs_Worked/WE_Per_User)
This can then be used to create the Pivot Table:
In the Pivot Table, the
Total Hrs is the SUM of Hrs Worked
Hrs-Daily is the Average of Hrs Worked,
Weekly Hrs is the Average of AvgHrs/Wk