cancel
Showing results for
Did you mean:
Helper II

## Calculation Between Two Columns - Rolling 24 Months - New Month Gets Added, Oldest Month Drops Off

I've hit a roadblock on a report I'm working on.

I have data like the attached.  It shows a list of locations, then has the revenue for each of the past 24 months and the number of business days in each of the last 24 months.  With this, I can calculate daily average growth (DAG).

With static data, it is easy to do the following calculation:

(((Revenue AUG 2019)/(Business Days in AUG 2019))-((Revenue AUG 2018)/(Business Days in AUG 2018)))/(Revenue AUG 2019)/(Business Days in AUG 2019)

The problem is, the oldest month on the report will drop off and be replaced by the most recent month.

In this case, it means that, next month, SEP 2017 will fall off and be replaced by SEP 2019.  As such, I can't build a calculation off of existing header names - they will be changing month to month.

Is there a way to do a calculation based off of the column number rather than the column name?  For instance, take the above calculation and replace header names with a column number?

Is there another solution I should be searching?

Ideally, when I am done, I will have Revenue, Business Days, and DAG for every sales location for the last 12 months.

This is a sample of the data.  It goes out to 48 columns in the query.

 Location Revenue AUG 2019 Business Days AUG 2019 Revenue JUL 2019 Business Days JUL 2019 Revenue JUN 2019 Business Days JUN 2019 Revenue MAY 2019 Business Days MAY 2019 RevenueAPR 2019 Business Days APR 2019 Alabama 1382689.5 21 1269324.34 21 1369134.09 21 1078965.78 21 1000799.88 21 Alaska 1458752.43 21 1409564.96 21 1272245.54 21 1347723.84 21 1127298.6 21 California 1620720.21 21 1334704.87 21 1040614.8 21 1201193.03 21 1182246.59 21 Deleware 1978296.83 21 2291016.27 21 2109485.17 21 2190225.58 21 2106644.09 21 Florida 968349.04 21 1119913.61 21 979007.91 21 1078147.98 21 1199920.92 21 Georgia 1741838.23 21 1869439.93 21 1605837.01 21 1854699.02 21 1903840.14 21
Community Support

Sorry i'm a little confused with your request, could you please share your dummy pbix/complete worksheet to indicate the expected data? list all the column data with expected result and simple logic would be helpful for us to generate the valuable advice.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

Announcements