PowerPivot FILTER() not working as expected for filtering Pivot Table

Vaslo

Board Regular
Joined
Jun 3, 2009
Messages
159
I have a table that has a bunch of =SUM()/CALCULATE Calculated Fields. Items like:

Code:
Total Gallons:=SUM(MasterData[Net Quantity in GAL])
Code:
Total Gallons YTD:=CALCULATE ( [Total Gallons], DATESYTD ( MonthOnlyDateTable[Date] ) )

etc. for the usual financial metrics

I created a pivot table to list to provide Top 10 reports by Business Segment. I get results for one segment like below when I sort on Margin:

CustomerTotal Volume YTDTotal Margin YTD
A2501000
B123300
C00
D0-5
E100-100

<tbody>
</tbody>

What I would like to do is to remove all rows from the table where volume is 0 (so only customers A,B, and E remain). To test this I tried using FILTER() in the Total Volume to just eliminate everything less than 0 to start with:

Code:
Total Volume YTD:=CALCULATE ( [Total Gallons], DATESYTD ( MonthOnlyDateTable[Date] ) , FILTER(MyTable[Total Volume YTD]<0))

But I get this result of just getting a blank instead of losing the line:
CustomerTotal Volume YTDTotal Margin YTD
A2501000
B123300
C0
D-5
E100-100

<tbody>
</tbody>

What is the best way to omit results from a Pivot Table based on excluding items according to one column?


Bonus question: Should I wrap my SUM() items in a CALCULATE()?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
What is the best way to omit results from a Pivot Table based on excluding items according to one column?

I think you have to constrain each other measure like this:

Code:
Total Margin YTD:=IF(ISBLANK([Total Volume YTD], BLANK(), ...)

When all measures in a pivot table row return blank, then Excel will hide that row.

Bonus question: Should I wrap my SUM() items in a CALCULATE()?

I think no. CALCULATE is all about modifying or creating filter context, it is not needed in simple measures.

Disclaimer: I'm a beginner with Power Pivot/DAX.
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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