Distinct Count by Date in PowerPivot Column - excel

I have a client I am importing lots of data from but to narrow it down it pulls in to powerpivot with a date column and a product column. They want to see a summary of how many days there was one item sold ("Solo Sale") two ("Double Sale") three, and four or more.
I am running into trouble due to the fact that they want to summarize the rest of their data by whether the day was a "Solo Sale" or "Double Sale" etc etc. Let's call this this the "Sale Count"
Because I need these "Sale Count" values on the rows of a Pivot Table, I'm trying to build a calculated column in the table that does a distinct count of the products by date but can't quite seem to get there using CALCULATE and/or FILTER. It always seems to give me a total distinct count of the products in the entire table rather than counting by each date.
Any advice on the DAX formula I should be using would be greatly appreciated. New to Power Pivot and I think I'm still thinking a little too excel-centric given there is very little row-logic in Power Pivot.
Thanks in advance!
Edited: Here is the table
PowerPivot Table
I would like the values in the SalesCount column to read 4 for every row with a date 1/1/2016, 1 for 1/2/2016, 2 for 1/3/2016, and 2 for 1/4/2016 (equivalent to the DISTINCTCOUNT of the Products on each day).
Then I would like to use conditional IF statements to replace those numbers with "Solo Sale" "Double Sale" etc so that I can use these values on the rows of a Pivot Table.

Try this as your calculated column:
=CALCULATE(
DISTINCTCOUNT(Table1[Product]),
ALLEXCEPT(Table1, Table1[Date])
)

Related

Function to filter excel table data in to a new dataset based on value defined in another table

I have two tables of data, the first is EmployeeSalaryTbl which holds the salaries for employees over time:
and the second StaffDetailsTbl which has details on the employee discipline etc.
I use various columns from the tables in a function to calculate total employee salaries per month and I'd like to re-purpose the function to only calculate the salaries dependent on a specified discipline in a given cell, for example Progamming.
To do this, I was thinking, is it possible to filter the results of EmployeeSalaryTbl[Employee], EmployeeSalaryTbl[Salary Start Date], EmployeeSalaryTbl[Salary End Date] etc to only contain the rows where the employee has the Programming discipline through a lookup in to the StaffDetailsTbl?
If it doesnt need to be pretty and you just want to sum the totals
You could put this in the column next to your table, starting at the first row you want to check from. then at the bottom sum up the values. You can change where it says programming to make it a cell reference if you want to check for various disciplines
=IF(INDEX(StaffDetailsTbl[Discipline],MATCH(EmployeeSalaryTbl[[#This Row],[Employee]],StaffDetailsTbl[Employee],0))="programming",EmployeeSalaryTbl[[#This Row],[Salary]],"")

Assistance needed pivot table, Countif, Averages, and tons of data

I have a pivot table with employees names, their grand totals of cases worked for the month, the days they worked during the month, and the case counts for each day.
I have them all stacked on top of each other on a sheet for fast viewing.
I created a column to countif Column (A) has a partial text value that matches the month.
In that column (AR) it returns 1 for true and 0 for not true.
I'm trying to create a formula where it sums up the 1s between the 0s.
The picture is horrible due to the size limits.
Basically, I need to count the days the employee worked and find the average case count for the month for each employee.
I can't use the average function in the pivot table because the count is based on IDs.
I tried If statements, and SumIfs.
ATTACHED IS A SAMPLE OF THE FILE I'M WORKING WITH
Picture of the Spreadsheet as requested
Sorry, i'm working on Excel in french. But I hope my answer with the file modified will help u understand what I'm talking about.
Here is your Excel sample with my modifications : Your Excel file that I modified
You can create another pivot table, that uses your previous pivot table as new datasource. But before doing that, make sure the elements of your first column "Claimed by" is repeated, by checking the column option "repeat element labels" like this :
In this new crosstab, you add as columns : the sum of "Case Count" ; and the count of "Days".
After that, you can filter the column "Claimed by" by selecting only elements without the word "total".
Then your average will be obtained simply by dividing the two columns.

How can I customize the totals column and rows in an excel pivot table

I am starting to use the Excel data model and pivot tables. I am struggling to produce the results I want for budgeting type tables. Given my very simplified example:
I had no problem creating the pivot table with sums for each category of income and expense. I used a slicer for year. The problems I have are with the Totals.
I want a column grand total which is the sum of income - the sum of expense, but it appears that pivot tables always use the same formula for every value in the table regardless of it being in a totals row or column.
In addition to the Total for the year for each row, I would like a monthly average column.
Both these seem to me like obvious things to do with a pivot table. The pivot table makes aggregating all the transactions from the journal trivial. I feel like I must be missing something, because I can't find a way to do something so obviously useful.

How do I filter a pivot table for MTD, QTD, and YTD?

I have a column full of specific date and time information, but I want use that data to filter my table to show only MTD, QTD, and YTD rows.
I can't upload an image of my table because of my work computer program, but I have the variable with the dates in the "report filter" field. The data in the column is given as an individual date and time, so that's all I can select when I try to filter it. There's too many option, and I need to be able to select simply QTD, MTD, or YTD dates. How can I do this? Apologies for the lack of imagery.
Select any part of the Pivot table
Under the Analyze tab of the ribbon select Insert Slicer or Insert Timeline whichever you prefer
Filter the dataset based on the criteria you want.
This won't give you your select columns, but without seeing the way you're data is structured should be a good fix.
If you have the issue where the dates won't summarize by month you can create two new columns to summarize the data and create a table with the following columns:
Month # / Month Name
1 January 'you can use whatever naming convention you prefer (jan, etc.)
2 February
....
Then you want to use the MONTH function combined with a VLOOKUP. It should look like =vlookup(month( [date cell reference]), [table you just made], 2, 0) This will pull the month name. Then you can use the YEAR function to get the years. Then make sure the pivot table accounts to the adjusted range and pull those in instead of date. You can still use the slicer and timeline to filter out the dates, but it will be summarized based on these new labels.

Column Name in Pivot table is a day Need to group by month

Good Morning,
New user here; need assistance please. My data is structured with days across a spreadsheet. t1 = 9/30/2016, u1 = 10/1/2016, v1 = 10/2/2016 etc...
The right side of the sheet s1:s711 has structured data which are the specific employee numbers i.e. 5672291. These are unique identifiers and do not repeat.
The data contained between t2:bsa711 represents the amount of sales on a given day for the employee.
I have tried several sumifs and sumproduct functions to capture the amount of sales for each employee by month. This did not work due to the multiple criteria (employees name and <= EOMONTH => EOMONTH criteria to sum the sales within the month)
My last attempt has been to pivot the data and group by month, but I am unable to produce the desired result because I can only get column names (the days) in the pivot list (1000+ due to the T-BSA range of columns/days).
My overall goal is to know the total per month I am not averse to using pivot or some type of array sumifs. Sorry that I do not have much to add to show research. I have been looking.
Thank you in advance.
Make sure the dates are formatted as dates.
Click on analyze -> insert timeline-> select column for dates.
You might want to experience with slicer and pick the days you want which is even more specific.

Resources