Bank Accounts that Change from Department to Department in a Daily Cash Report

Tuta

Board Regular
Joined
Nov 6, 2008
Messages
85
Office Version
  1. 365
Platform
  1. Windows
Setup:

I am trying to set up a very simple end of day cash balance report. Fact table will be a list of all bank accounts and the end of day cash balance. I have lookup tables keyed on account number to link things like Bank Name, Country, and Department.

Problem:

Over the course of the year, any single account may be moved from department to department. So, account 1111 might be in Department A for 1/1/2020 - 5/15/2020, and then moved to Department B for 5/16/2020-onward.

For my visuals, the user will be selecting a single date from a SLICER .

I want to make sure that when a date is picked, the Account's cash balance is included in the correct Department, but I am having trouble with writing that measure (or calculated column if that is best).

What is best practice for setting something like this up with effective dates? Thanks so much!

Example of Lookup table:
Test for May.xlsx
ABCDEF
1Account NumberCountryBank NameDepartmentDepartment Start DateDepartment End Date
21111USAChase BankDepartment A1/1/20206/30/2020
32222USABank of AmericaDepartment A1/1/2020
43333AustraliaAustralia National BankDepartment A1/1/2020
54444BrazilBrazil BankDepartment A1/1/2020
65555AustraliaAustralia National BankDepartment B1/1/2020
76666CanadaCanada First BankDepartment B1/1/2020
87777CanadaCanada First BankDepartment B1/1/2020
98888UKRoyal BankDepartment C1/1/2020
109999USAJP MorganDepartment C1/1/2020
111111USAChase BankDepartment B7/1/2020
Sheet1


Fact table:
Test for May.xlsx
ABC
1Account NumberCash BalanceDate
21111$ 49,433,729.001/1/2020
32222$ 43,764,083.001/1/2020
43333$ 25,655,834.001/1/2020
54444$ 3,078,702.001/1/2020
65555$ 9,520,004.001/1/2020
76666$ 15,658,861.001/1/2020
87777$ 31,283,507.001/1/2020
98888$ 48,068,531.001/1/2020
109999$ 36,436,769.001/1/2020
111111$ 38,056,864.001/2/2020
122222$ 1,229,319.001/2/2020
133333$ 6,587,544.001/2/2020
144444$ 41,818,337.001/2/2020
155555$ 9,010,454.001/2/2020
166666$ 42,345,150.001/2/2020
177777$ 23,146,931.001/2/2020
188888$ 47,767,511.001/2/2020
199999$ 9,722,558.001/2/2020
201111$ 17,657,590.001/3/2020
212222$ 50,448,822.001/3/2020
22{ and so on and so on}
Sheet2
Cell Formulas
RangeFormula
B2:B21B2=RANDBETWEEN(0,55000000)



Example of visuals....
example_visuals.JPG
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
1My Excel Trick Collection.xlsm
ABCDEFGHIJKL
1AccountCountryBank NameDepartment Start DateEnd Date
21111USAChase BankDepartment A01/01/202002/01/2020Sorce Data for pivot
32222USABank of AmericaDepartment B01/01/202002/01/2020AccountCash BalanceDateDepartmentCountry
43333AustraliaAustralia National BankDepartment B01/01/202005/01/202011113936875801/01/2020Department AUSA
54444BrazilBrazil BankDepartment B01/01/202001/01/202022224552326101/01/2020Department BUSA
65555AustraliaAustralia National BankDepartment C01/01/202001/01/202033334192957501/01/2020Department BAustralia
71111USAChase BankDepartment B03/01/202004/01/2020444485874701/01/2020Department BBrazil
82222USABank of AmericaDepartment A03/01/202004/01/202055554710265501/01/2020Department CAustralia
93333AustraliaAustralia National BankDepartment B06/01/202010/01/202011112566023002/01/2020Department AUSA
104444BrazilBrazil BankDepartment C02/01/202004/01/202022221778541802/01/2020Department BUSA
115555AustraliaAustralia National BankDepartment B02/01/202002/01/202033332426123402/01/2020Department BAustralia
121111USAChase BankDepartment A05/01/202030/01/202044443596797102/01/2020Department CBrazil
132222USABank of AmericaDepartment C05/01/202028/01/202055552447348802/01/2020Department BAustralia
143333AustraliaAustralia National BankDepartment B11/01/202030/01/202011111066445803/01/2020Department BUSA
154444BrazilBrazil BankDepartment B05/01/202030/01/202022223851777903/01/2020Department AUSA
165555AustraliaAustralia National BankDepartment B03/01/202030/01/202033331767740703/01/2020Department BAustralia
1744444826697703/01/2020Department CBrazil
1855554920535403/01/2020Department BAustralia
1911113404512304/01/2020Department BUSA
202222580586204/01/2020Department AUSA
21Row LabelsSum of Cash BalanceRow LabelsSum of Cash Balance33332236264704/01/2020Department BAustralia
22Australia$231,582,521.00Department A$109,352,629.0044443511271204/01/2020Department CBrazil
23Brazil$120,206,407.00Department B$293,356,873.005555457016104/01/2020Department BAustralia
24USA$217,370,889.00Department C$166,450,315.00
25Grand Total$569,159,817.00Grand Total$569,159,817.00
26
27
28
29
Sheet2
Cell Formulas
RangeFormula
K4:K23K4=INDEX($D$2:$D$16,SUMPRODUCT(IF(((H4=$A$2:$A$16)*(J4>=$E$2:$E$16)*(J4<=$F$2:$F$16))=1,ROW($D$2:$D$16)-ROW($D$1))))
L4:L23L4=INDEX($B$2:$B$16,MATCH(H4,$A$2:$A$16,0))
Press CTRL+SHIFT+ENTER to enter array formulas.


I think you can create helper column and pull the active department name from the bank and use cash balance table for pivot table or create a powery query.
 

Attachments

  • Screenshot (27).png
    Screenshot (27).png
    73.5 KB · Views: 7
Upvote 0
@alz - this does work and gets us to the desired result.

Is there an equivalent bit of DAX or M that we could replicate the INDEX/SUMPRODUCT work in excel to occur during load or once in Power BI?

Thanks so much!
 
Upvote 0

Forum statistics

Threads
1,215,263
Messages
6,123,959
Members
449,135
Latest member
jcschafer209

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