Let’s take a look at something that’s SO easy to calculate today with a simple spreadsheet but was very challenging to calculate in the past.

(post inspired by Eugenia Chen’s wsj article)

**Arithmetic Progression**

“A sequence in which the numbers increase by the same amount at each step” (source).

Try to calculate this in your head:

Start with 2. Add 4 to it 10 times.

What’s the SUM? What’s the MEDIAN?

These are the values: 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42. SUM is 242 and MEDIAN is 22.

Long sequences were very difficult even for mathematicians before calculators and computers.

**Sequences in Excel**

It’s easy to create sequences in Excel. (Excel file: save to computer and then open).

These are the inputs.

Below is a non dynamic array solution that is backwards compatible.

And finally the calculations:

**1 Formula Solution**

My solution above contains several steps. Let’s create sequence values from a single formula!

**Option A**

=SEQUENCE(C2,,A2,B2)

=TEXTJOIN(“, “,TRUE,SEQUENCE(C2,,A2,B2))

SEQUENCE is a dynamic array. Requires Office 365 Excel version. TEXTJOIN keeps it from spilling.

**Option B**

=TEXTJOIN(“, “,TRUE,B2*ROW(INDIRECT(“1:”&C2))-A2)

Formula above is an array and requires Control Shift Enter (just not Enter).

**Option C**

=B2*ROW(INDIRECT(“1:”&C2))-A2

Formula above doesn’t require Control Shift Enter (just Enter). It spills down into the cells below.

**Sequences in Power BI**

(download my pbix file.)

GENERATESERIES quickly creates a sequence:

Start with a 2, end at 42, intervals of 4. GENERATESERIES creates a table with 1 column.

Below I use variables but it does the same thing as above. So, is it really necessary?

Both DAX versions above contain only internal inputs. Could I connect to an input from outside?

After experimenting I created a measure that I referenced when creating a new table.

Here’s the measure:

Here’s the new table that references the measure above:

**My Dad The Calculator**

My dad was really good at math. We would quiz him with multiplication and division questions. He seemed to be able to calculate anything. Hmm…maybe he would also fake some answers knowing that we wouldn’t know the difference.

I don’t think even he could have calculated a simple sum for a long sequence in his head. I bet he would’ve been a big spreadsheet and database fan. I remember that in the mid 1970s my older cousin had a calculator and it was a big deal. Around 1980 I went with my dad to visit his lawyer. He had one of those classic server room computers. I found it fascinating but it probably was less powerful than a smartphone from today.

**What’s next?** Imagine what things will be like forty years from now. Today’s technology will be ancient.

**About Me**

My name is Kevin Lehrbass. I live in Markham (near Toronto) Ontario Canada.

I’ve been working with data for almost 20 years now. SQL (various databases), Excel and now Power BI (DAX).

I find it all so interesting that I also have this blog 🙂