Craigc3814
Board Regular
- Joined
- Mar 7, 2016
- Messages
- 217
I am using Excel 2016 Power Query & Power Pivot. I am going to do my best to explain this but I do not know if I can.
I get a massive bill from a vendor each month that has about 350 different account numbers on it. The bill tells me our usage and our charge. It comes in a .txt file
I use PowerQuery to clean that up and load it to a Power Pivot table.
What I need to do is account number by account number look and see how many months it has been since a change to the usage row has changed. So if I have received 6 bills in a row for the same usage, I want a column that returns 6.
I can think of two ways to MAYBE pull it off but you guys are genius here so I figured I would check prior to attempting something awful.
My thought is
A I have a table dedicated to just the most recent bill. It brings in all of the data for the current month bill. I also have the table that compiles all bills as I mentioned earlier. I was thinking there was some way through PowerPivot I tell the current month table to look at the compilation table and return me the first month that DOES NOT match then I could formulate current month minus the bill month returned
B Through PQ Organize Everything in the Compilation table by Account Number then ZtoA on Bill Month. Create some type of index column, then modulo column and subtract the difference to return the 6 months.
Any thoughts would be a game changer for me, I know people like to see the data unfortunately I am not allowed to share it so I will Mimic 1 tables below
Compilation Table
Acct # Month Rate Code Usage Charge
001 4/1/18 129 800 $12,507
001 4/1/18 145 150 $129
001 5/1/18 129 1000 $15,329
001 6/1/18 129 1000 $15,329
001 7/1/18 129 1000 $15,329
002 4/1/18 129 1300 $18,793
So I would want a 3 returned for acct # 001 Rate 129
The Current Month table is the EXACT same format. Only difference is it does not compile bills it just shows this months information for each account
I get a massive bill from a vendor each month that has about 350 different account numbers on it. The bill tells me our usage and our charge. It comes in a .txt file
I use PowerQuery to clean that up and load it to a Power Pivot table.
What I need to do is account number by account number look and see how many months it has been since a change to the usage row has changed. So if I have received 6 bills in a row for the same usage, I want a column that returns 6.
I can think of two ways to MAYBE pull it off but you guys are genius here so I figured I would check prior to attempting something awful.
My thought is
A I have a table dedicated to just the most recent bill. It brings in all of the data for the current month bill. I also have the table that compiles all bills as I mentioned earlier. I was thinking there was some way through PowerPivot I tell the current month table to look at the compilation table and return me the first month that DOES NOT match then I could formulate current month minus the bill month returned
B Through PQ Organize Everything in the Compilation table by Account Number then ZtoA on Bill Month. Create some type of index column, then modulo column and subtract the difference to return the 6 months.
Any thoughts would be a game changer for me, I know people like to see the data unfortunately I am not allowed to share it so I will Mimic 1 tables below
Compilation Table
Acct # Month Rate Code Usage Charge
001 4/1/18 129 800 $12,507
001 4/1/18 145 150 $129
001 5/1/18 129 1000 $15,329
001 6/1/18 129 1000 $15,329
001 7/1/18 129 1000 $15,329
002 4/1/18 129 1300 $18,793
So I would want a 3 returned for acct # 001 Rate 129
The Current Month table is the EXACT same format. Only difference is it does not compile bills it just shows this months information for each account