Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Running Total with Blank Month Values

I'm trying to create a calculation that shows the cumulative totals including for the ones with no data. I have been checking similar questions in this forum but nothing has solved my issue yet. I'm ...
  • V-lianl-msft's avatar
    5 years ago

    Hi Anonymous ,

     

    Based on your description, I will choose to create a calculated table. First, I need to create a measure to calculate the value of blank date.

     

    Measure = 
    var contribution =  
        CALCULATE(
            SUMX(
                FILTER('Table',
                    'Table'[Start Date]<=MAX('Table 2'[Date]) 
                    && (ISBLANK('Table'[End Date]) || 'Table'[End Date]>MAX('Table 2'[Date]))),
                ('Table'[Recurring Contribution])),
                CROSSFILTER('Table'[Start Date],'Table 2'[Date],None))
    return IF(contribution=0,SUM('Table'[One-time Contribution]),contribution)

     

    Then create a  calculated table.

     

    Table 3 = 
    var combination = CROSSJOIN('Table 2',VALUES('Table'[Country]))
    return SUMMARIZE(combination,
        'Table 2'[Date].[Year],'Table 2'[Date].[Month],'Table'[Country],
        "value",[Measure])

     

     

    You can refer to the sample .pbix

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.