Forum Discussion

alperkeskin90's avatar
alperkeskin90
New Member
1 year ago

Daily Amount

Hi,

 

 I have account number, account suffix, amount, name and trandate. I try to make a calculation. customer made his first transaction at 30/09/2015 which positive number and this means it is a investing money. There is also negative numbers which has - before it means taking money.  I try to calculate customer's daily amount. In this example customer invest money at 30/09/2015. after this draw money. after that again draw money. I want to calculate end of day balance. Additionally, as you see the customer did not make any transaction at 03/10/2015. In this case last balance amount must be written to 03/10/2015 day balance. To sum up, I want to calculate daily balance whether the customers make transactions or not on calendar date. The date can be start beginning of the 2015 and can end on end of the 2025. If the calendar day before customer's first transaction day it can be null. I can not find any solution for this.

PS: The data has 5 million rows so i can face with memory problems.

 

3 Replies

    • alperkeskin90's avatar
      alperkeskin90
      New Member

      please find it below. Thank you

       

       

      AccountNumberSum of AccountSuffixSum of AmountCustomerNameTranDate
      abc12451118,4210526Alper30.09.2015 00:00
      abc12451-112,5921053Alper01.10.2015 00:00
      abc12451-5,828947368Alper02.11.2015 00:00
      abc124546,389473684Alper04.11.2015 00:00
      abc12451-6,389473684Alper01.12.2015 00:00
      abc1245312,17039474Alper03.12.2015 00:00
      abc12451-6,557894737Alper30.12.2015 00:00
      abc1245165,78947368Alper05.01.2016 00:00
      abc12451131,5789474Alper06.01.2016 00:00
      abc12452-193,1638158Alper12.01.2016 00:00
      abc12453-9,210526316Alper17.02.2016 00:00
      abc12457-0,341315789Alper23.02.2016 00:00
      abc124512,894736842Alper25.02.2016 00:00
      abc12452-2,647368421Alper26.02.2016 00:00
      abc124510,657894737Alper03.03.2016 00:00
      abc12452-1,170526316Alper17.03.2016 00:00
      abc124530Alper22.03.2016 00:00
      abc124550Alper11.04.2016 00:00
      abc124550Alper14.04.2016 00:00
      abc124530Alper19.04.2016 00:00
      abc124570Alper20.04.2016 00:00
      abc124550,972894737Alper21.04.2016 00:00
      abc124517,894736842Alper27.04.2016 00:00
      abc12457-5,778684211Alper02.05.2016 00:00
      abc12451-3,088947368Alper01.06.2016 00:00
      abc124590Alper06.06.2016 00:00
      abc124570Alper07.06.2016 00:00
      abc124542,718421053Alper13.06.2016 00:00
      abc12451-2,718421053Alper01.07.2016 00:00
      abc12451171,0526316Alper07.07.2016 00:00
      abc12451131,5789474Alper08.07.2016 00:00
      abc124510-301,2509211Alper12.07.2016 00:00
      abc12454-1,380657895Alper01.08.2016 00:00
      abc124590,727894737Alper03.08.2016 00:00
      abc12451-0,727894737Alper01.09.2016 00:00
      abc124530Alper06.09.2016 00:00
      abc124530Alper07.09.2016 00:00
      abc1245111,051052632Alper08.09.2016 00:00
      abc12451-1,051052632Alper04.10.2016 00:00
      abc124590,923289474Alper07.10.2016 00:00
      abc12452-0,923289474Alper26.10.2016 00:00
      abc124550Alper07.11.2016 00:00
      abc1245102,877105263Alper08.11.2016 00:00
      abc12451-1,315789474Alper10.11.2016 00:00
      abc124510,547631579Alper11.11.2016 00:00
      abc12452-2,108947368Alper21.11.2016 00:00
      abc1245210Alper05.12.2016 00:00
      abc124520Alper06.12.2016 00:00
      abc124515,486842105Alper16.12.2016 00:00
      abc12451-5,486842105Alper23.12.2016 00:00
      abc1245225,344342105Alper05.01.2017 00:00
      abc12452-5,344342105Alper09.01.2017 00:00
      abc1245200Alper07.02.2017 00:00
      abc124540Alper08.02.2017 00:00
      abc1245120Alper01.03.2017 00:00
      abc124520Alper14.03.2017 00:00
      abc1245220,004736842Alper05.04.2017 00:00
      abc1245510,47671053Alper07.04.2017 00:00
      abc12451-0,197368421Alper11.04.2017 00:00
      abc12451131,5789474Alper28.04.2017 00:00
      abc124514-128,5439474Alper02.05.2017 00:00
      abc12457-0,968947368Alper10.05.2017 00:00
      abc12451151,3157895Alper30.05.2017 00:00
      abc124510-145,7215789Alper01.06.2017 00:00
      abc12451-0,526315789Alper07.06.2017 00:00
      abc1245130,857105263Alper03.07.2017 00:00
      abc1245130,857105263Alper01.08.2017 00:00
      abc12453-11,66289474Alper15.08.2017 00:00
      abc12451-7,469342105Alper01.09.2017 00:00
      abc1245190Alper04.09.2017 00:00
      abc124578,162368421Alper05.09.2017 00:00
      abc12451-8,162368421Alper02.10.2017 00:00
      abc1245150Alper04.10.2017 00:00
      abc1245100Alper05.10.2017 00:00
      abc124530Alper06.10.2017 00:00
      abc124570Alper09.10.2017 00:00
      abc1245249,84065789Alper10.10.2017 00:00
      abc12451-3,697368421Alper19.10.2017 00:00
      abc12458-46,14328947Alper01.11.2017 00:00
      abc124590Alper06.11.2017 00:00
      abc1245814,08381579Alper07.11.2017 00:00
      abc1245178,94736842Alper30.11.2017 00:00
      abc12454-93,03118421Alper01.12.2017 00:00
      abc12451724,08513158Alper05.12.2017 00:00
      abc12455-24,08513158Alper02.01.2018 00:00
      abc1245120,697105263Alper08.01.2018 00:00
      abc12451-0,697105263Alper01.02.2018 00:00
      abc1245110Alper05.02.2018 00:00
      abc124520,004210526Alper08.02.2018 00:00
      abc124550Alper05.03.2018 00:00
      abc12457-0,004210526Alper04.04.2018 00:00
      abc124550Alper05.04.2018 00:00
      abc124570,656052632Alper06.04.2018 00:00
      abc124550,101842105Alper02.05.2018 00:00
      abc12451-0,757894737Alper01.06.2018 00:00
      abc124540,859736842Alper04.06.2018 00:00
      abc12454-0,859736842Alper02.07.2018 00:00
      abc124550,948026316Alper03.07.2018 00:00
      abc12451-0,948026316Alper01.08.2018 00:00
      abc124571,426710526Alper06.08.2018 00:00
      abc124550,1025Alper03.09.2018 00:00
      abc124531,045789474Alper01.10.2018 00:00
      abc1245115,78947368Alper30.10.2018 00:00
      abc12451-16,05947368Alper01.11.2018 00:00
      abc12451-2,305Alper21.06.2024 00:00
      • Rupak_bi's avatar
        Rupak_bi
        Super User

        Hi alperkeskin90 
        Here Is your Solution.

        Steps to do:

        1. Forst of all your "TranDate " is not in date format. So I did an extra step to create a calculated date column in the dataset.

        The formula Is as below:

        New Tran date =

        var A = find(".",'Table'[TranDate],1)
        var _day = left('Table'[TranDate],A-1)
        Var B = FIND(".",'Table'[TranDate],A+1)
        Var _month = mid('Table'[TranDate],A+1,B-A-1)
        Var _year = mid('Table'[TranDate],B+1,4)
        return
        date(_year,_month,_day)
        2. Create a date table from 2015 to 2025
        Date = CALENDAR(date(2015,1,1),date(2025,12,31))
         
        3. Now Create a Measure to get cumulative sum of the amount for each customer. (Hope you have other customers as well.)
        Closing balance = calculate(sum('Table'[Sum of Amount]),ALLEXCEPT('Table','Table'[CustomerName]),'Table'[New Tran date]<=max('Date'[Date]))
         
        4. Now plot it in a Matrix using date from the date table in the row and the measure as value. Thats IT.
         
        hop this will work. If not, let me know.