Filter pivot table if any month value is not zero

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
I have a table with a column of dates and a column of values, which should all be zero (variances).

When I pivot this and put the dates in the columns, I want to filter the table so that all rows with a variance in any month will remain. But when I use a value filter, it just filters for the summed value of all months, so that if January is -10 and February is +10, it would net to zero and not be captured.

Is there any way to do this, either with basic pivot table functionality or using a calculated measure (DAX)?

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Sorry if this is not the right place to ask this but, is there any easy way to paste an example such as a screenshot? Or do I have to manually type in table values?
 
Upvote 0
Here is an example of what the table may look like.

NamePeriod (Data Type is Date)Value
AJan 2016-5
AFeb 20165
BMar 20163
CApr 2016-7

<tbody>
</tbody>

If this is pivoted where

Rows: Name column
Columns: Period column
Values: Value column

Then you would get something like

Jan 2016Feb 2016Mar 2016Apr 2016Grand Total
A-55000
B00303
C000-7-7

<tbody>
</tbody>

Now, if I apply a Values filter to the row labels and say Does Not Equal it would just give me the option of "Value" does not equal and I enter 0. This basically is filtering based on the Grand Total column, so A would get filtered out. However, since Jan and Feb have non-zero values, I would want to see them.

Short of converting all values to absolutes, is there a way to filter this table to basically say if any value in any of the columns is not 0, then keep that row?
 
Upvote 0
At the beginning of this forum there is an announcement about Recommended Add-ins and Links
to paste a screenshot MrExcel HTML Maker is usefull.

I asked an example to understand variation over months: January -10 and February 10 -> skip, but what if March -5? Should February reappear?


Posted after your answer
</posted>
 
Last edited:
Upvote 0
Try to add =COUNT(B5:E5) at the right of Grand total. If you keep empty cells as in pivot this shows evidence of variation and a filter on it will preserve evidence even if balance is 0
 
Upvote 0
1. From PowerPivot new PivotTable
2. In ROWS - Name, In COLUMNS - Period, In VALUES - Values
3. Disable in PivotTable Options /Total & Filters/ Show grand totals for columns
 
Last edited:
Upvote 0
A couple of ideas I can think of:
  1. Turn zeros into blanks, then the default "empty row removal" feature of pivot tables will hide those rows.
    You can do this using two measures like:
    Code:
    Value Original := SUM( YourTable[Value] )
    Value with zeros hidden := IF ( [Value Original] = 0, BLANK(), [Value Original] )
    Then put [Value with zeros hidden] in the Value field of the pivot table.
  2. Create a measure which counts the number of periods for which [Value Original] is nonzero, and use this in a Value Filter. Assuming [Value Original] is defined as above:
    Code:
    Num Periods with Nonzero Value :=
    COUNTX(
        VALUES( YourTable[Period] ),
        IF ( [Value Original] <> 0, 1 )
    )
    Don't show this measure on the pivot table, but filter Name using a Value Filter so that "Num Periods with Nonzero Value > 0".

Owen :)
 
Last edited:
Upvote 0
Thanks for all the suggestions.

Regarding those calculated fields in Ozeroth's post, will that still work if the net total is zero? For instance, if May is -10 and June is +10, will the COUNTX formula still see that as zero and filter it out? I need to see all rows where any individual month is non-zero.
 
Upvote 0
Yes they will.
I tested filtering on the COUNTX measure myself and it kept rows with nonzero months but zero totals.
Since it iterates over months, it will count nonzero months regardless of grand total.
Try it yourself and confirm though : )
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,826
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top