Pivot Table get value from previous month - excel

I have a pivot table with the rows: Product and **Date ** (which shows the months) and values of: Sum of Starting, Sum of InTransit, Sum of Ending, all show inventory levels.
In the inventory report that I receive monthly, the Starting value is incorrect since it doesn't include the inventory which is InTransit. I would like to create a calculated field which will show the true inventory levels, it should add the Sum of InTransit value of the previous month to the current month Sum of Starting value. Another calculated field for the true end of month inventory, should sum the Sum of InTransit + Sum of Ending of the current month, but this is quite straightforward. I tried the function previousmonth, OFFSET, none seems to work.
Would truly appreciate your help!
Thanks!
Pivot Table
Pivot Table Fields

Related

Excel - sumifs condition is true but result is 0

I try to sum all rows K30:K49 where with the same year and quarter in G30:H49 as in the header G1, G2. My formula is:
=SUMIFS(K30:K49;G30:G49;G30*10+H30=G$1*10+G$2)
But it returns 0. I tried Evaluation feature and I can see that the condition is evaluated to TRUE. So I expect that it will sum the column K. Where is my mistake?
Is your goal to sum all 2020 quater 1, 2020 q 2 and so on?
In that case you need more than one criteria range and criteria.
=SUMIFS(K30:K49;G30:G49;G1;H30:H49;G2)
This makes sure it's 2020 and q1, or 2020 and q2
(And 2020 q1 should return 0, if this is all the data there is, but q2 should return 27000)
In case a Pivot Table could work for you, I made a fake dataset to replicate yours:
And I have resume the data with a Pivot Table:
My Pivot Table setup is:
ROWS: Year field
COLUMNS: Quarter field
VALUES: Sum up Values field
Also, if you need an horizontal design, you can do it like in your image with a Pivot Table too, just taking Year field and Quarter Field into Columns Section:
If you use this second option, and you got Excel 2010 or higher, there is an option called Repeat item labels in a PivotTable to repeat all years values, like your original design.
Hope this helps.
UPDATE: Checked your example file. I made a Pivot Table with this setup:
ROWS: Source field
COLUMNS: Year field and Quarter Field
Changed form design to TABULAR
Deactivated all SUBTOTALS
Activated GRANDS TOTALS ONLY FOR COLUMNS
In the Pivot Table Options, option in empty cells show I said show a 0
This is the result, very similar to what you want.

Calculated Fields in excel pivot

I have column ('CSAT') in a sheet that has numbers 1 and 0 in each cell. '1' represents 'Satisfied' and '0' represents 'Disatisfied'. I want to make a pivot from this sheet and have a new calculated field in it ('CSAT %') that will give me the score by dividing (Total 'Satisfied') count by (Total 'Dissatisfied + Total 'Satisfied') * 100.
I tried with COUNTIF but i dont think we can use this formula in pivot
Calculated Fields and Items in PivotTables are tricky. The main tripping point is understanding that Calculated Fields and Items operate on the totals, not on the individual values in the underlying data.
For example, if you created a new Field that was equal to Field1 * Field2 and data is being summarized by SUM, Excel doesn't multiply all of the respective values in each field and then sum the results. It first sums the fields for each category and then multiplies those results. What it's really doing is SUM(Field1) * SUM(Field2) for each category.
You can use some worksheet functions in the calculated fields, but you have to remember you're still operating on the totals. So if you created a new Field that was equal to Count(Field1) * Count(Field2), you're (almost) always just going to get an answer of 1. This is because the calculation is actually doing Count(SUM(Field1)) * Count(SUM(Field2)) for each category. The sum of each field is a single number, so the calculation is just doing 1*1 for each category.
So for this reason, you can't use aggregating functions like SUMIF or COUNTIF which need to look at each individual elements. Since you need to look at individual elements, you actually can't use a Calculated Field for your solution at all.
What you can do is use a Calculated Item!
The main catch here is you can't use any field in more than 1 location when calculated items are involved. Excel just throws an error message saying you're not allowed.
So if you have a category column as well as the CSAT column, you need to create another dummy column full of 1's to operate on.
You can then set up pivot table as follows:
Category field to Rows.
Dummy field to Data area, summarized by Sum
CSAT field to Columns
Click on the CSAT column headers in the pivot table and choose: PivotTable Tools > Fields, Items, & Sets > Calculated Item
Set Name for your new Item to CSAT%
Enter the formula: ='1'/('0'+'1')
On the CSAT field, hide items 1 and 0, so only the CSAT% field is visible
Result:
A couple of notes:
When entering fields and items in calculated fields and items, do so by placing the cursor where you want in the Formula then double clicking on the field/item name from the lists below. This will add brackets and quotes as required in the correct format.
Note that the formula doesn't need SUM around the item names, because calculated fields/items always work on the total of values. They are totalled according to how the data is summarized in the pivot table.
The dummy column was added with all values of 1 so that summing these values gives you the count, from which the percentage can be calculated using the formula specified.
Answer without using calculated fields:
Assuming you have categories in the row fields, you can put CSAT as a column field as well as a data field then choose to summarize values by Count and show values as a percentage of row totals:
After putting CSAT in column and data fields, right click on the data and select Summarize Values By > More Options...
First choose to Summarize Values By Count:
Then click Show Values As tab and select % of Row Total:
You'll then have percentage of 1's under the CSAT=1 column:

Excel Get values from previous Week

In Excel I have a pivot table with Rows containing week numbers. I now want one measure that shows the value of the previous week next to the value of this week.
I did this before for previous month with following formula, but in excel there isn't a function called PREVIOUSWEEK, so how can I do this ?
IF([Incident Count] <> 0; CALCULATE(COUNTA(Incidents[Call Number]);PREVIOUSMONTH('Calendar'[Date]));BLANK())
I want the value to keep appearing even if I use a slider to select one month:
Any idea how to achieve this so I can have a column next to "Sum of aangeboden oproepen" with the value from the previous week ?
You can use this formula. You will need to create index column based on weeks. Please adjust formula to your needs.
=CALCULATE(SUM(Incidents[Incident count]),FILTER(ALL(Incidents),Incidents[Index]=MIN(Incidents[Index])-1))

DATESYTD returns no value

I have a "sales" table containing all sales data and created a measure:
Total Sales = SUM(std_adi[Nettopreis])
this works fine in power pivot.
Now I want a DATESYTD() measure and used:
Total Sales YTD = CALCULATE([Total Sales], DATESYTD(Dates[Date]))
but when I add this into the power pivot sheet, it contains "no value"
My "Dates" table has a column "Date" and has a relationship to the std_adi table, column order_date (which contains my sales data)
Am I missing something? I have the above DATESYTD formula from a book and looks identical to all the examples on the net
Even if I change the measure to:
=CALCULATE(SUM(std_adi[Nettopreis]), DATESYTD(Dates[Date]))
it contains "no value" which leads me to the point that something with the Dates Table might be wrong, but I can't find anything
It won't have a value unless you slice / filter your pivot by year.
If it still doesn't work check that your Dates table is marked as a Date table. Check that you have a date for every day in the timeframe you are looking at. And check that you can slice your Total Sales measure by Year from your Date table.
Your formula is fine.

Get each price per month for a category?

I have data with the entities date, name, price. I managed to get distinct categories in the Categories colume for each name with = LEFT(B2;FIND(" ";B2)). In fact I want to get for each categorie the summed up monthly prices per month.
My sheet:
I tried:
=SUMIF(B2:B6;LEFT(B2;FIND(" ";B2));C2:C6)
However, this formula returns 0 and also does not give me the prices per categorie and per month.
I really appreciate your help!!!
If you want a sum on each row which will sum for the category of the current row and the month of the current row you can use SUMIFS like this
=SUMIFS(C:C;E:E;E2;A:A;">"&EOMONTH(A2;-1);A:A;"<="&EOMONTH(A2;0))
SUMIFS requires Excel 2007 or later
=SUMIF(E:E,E2,C:C) will sum the categories for you
I think if you want to sum categories by date, you might want to use a Pivot Table or write a Macro
You can write a =sumif function with multiple criteria but I'm not sure how you would define the "date rage" for each new criteria

Resources