Is SUMMARIZE better than EARLIER?

masplin

Active Member
Joined
May 10, 2010
Messages
413
I'm about to embark on rebuilding a model that has been growing since 2011 and hopefully doing a better job of it with all I have learnt since that time, when I was making it up as a went along!

In my original model had had lots of calculations where i needed to calculate sub tables before performing some other function. In general they looked like:

CALCULATE(
COUNTROWS(Table),
FILTER(
Table,
Table[ABC]=EARLIER(Table[ABC]) &&
Table[XYZ]=EARLIER(Table[XYZ])
)
)

Would I be right thinking that i am much better to use SUMMARIZE to create any sub tables that then get looped through by another function?


CALCULATE(
COUNTROWS(Table),
SUMMARIZE(
Table,
Table[ABC],
Table[XYZ]
)
)

Just wan tot check i'm reading up on the right thing as not 100% clear about how to use SUMMARIZE effectively.

Thanks
Mike
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
I would love to see a "real" example here to wrap my head around it -- cuz honestly the first measure doesn't even look VALID to me...

Oh wait! Those are calc columns I guess? (not measures)
 
Upvote 0
Here's a typical example. I have a list of transactions where the vehicle reg num is repeated for each vehicle. I need to rank the visit in reverse date order. So yes this is a calculated column. There are 350,000 records and about 150,000 reg num ranging from 1 to 50 visits.

Code:
     =RANKX(          
                               FILTER(
                                           MatchInput,
                                           [Reg Num]=EARLIER([Reg Num])
                                           ),
                               [Inv Last Mod Date]+[Unique Ref]/10000000,,0
                              )

would SUMMARIZE(
Matchinput,
[Reg Num]
)

be better somewhere in here?

Thanks
Mike
 
Upvote 0
This should be low on your list of "things to worry about" :) The calc column is only going to be evaluated 1 time anyway (at refresh time), so it's not like perf matters a ton.

A better question is (typically) -- do I really WANT this calc column?

fwiw, I don't use SUMMARIZE very often.
 
Upvote 0
Hi Scott

Yes I appreciate that when i first started I wrote lots of calculated columns to follow that i was doing and I need to be removing as many as possible. My understand is unless you need the calculated column as a row/column/filter in the pivot table you should try to not have them.

Thanks
Mike
 
Upvote 0
As a general rule... Yes. Though, that only applies to fact/data table really. My calendar table always has a zillion helper columns. And some calcs are rough (RANKX), so that... a calc column makes sense (at long as you don't have to slice it).
 
Upvote 0

Forum statistics

Threads
1,215,759
Messages
6,126,727
Members
449,332
Latest member
nokoloina

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