Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Running total between two selected periods

Hello, I have a fact table with a relationship to a calendar table marked as Date table. Relation ship is one to n based on a date column. I can create time intelligence clculations like YTD, Previ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    Hello,

    Thanks for all your suggestions. I finally found a way to calculate this running total using a formula like this one.

     

    Cumulative Dollar :=
    IF (
        MIN ( 'Dim_Calendar'[ID_Date] )
            <= CALCULATE ( MAX ( BOL[Sailing_Date_Key] ), ALL ( BOL ) );
    CALCULATE(SUM(Bol[AmountUSD]),
    Filter(
    ALLSELECTED('Dim_Calendar'),'Dim_Calendar'[DateASDate]<=MAX('Dim_Calendar'[DateASDate])))
    )

    Which produces exactly the result I want

      YYYYWK  AmountUSD  Cumulative

    2018461'327'2431'327'243
    2018471'192'8902'520'134
    2018481'604'9164'125'049
    201849745'2564'870'306
    20185020'7924'891'098
    201851 4'891'098
    201852 4'891'098
    201901 4'891'098
    201902 4'891'098
    201903 4'891'098
    201904 4'891'098
    201905 4'891'098
    201906 4'891'098
    20190732'8344'923'932
    201908 4'923'932
    201909 4'923'932