Forum Discussion

josephc's avatar
josephc
Frequent Visitor
9 years ago
Solved

Running Total/Calculated Sum and ignoring null values at end of list

I have the following query to summarize a list of numbers and its result   mEarnedCum = CALCULATE ( SUM ( PBIScheduleSummaryPeriod[ActivePeriodsEarnedMH] ), FILTER ( ALLSELECTED ( P...
  • dedelman_clng's avatar
    9 years ago

    Try wrapping an IF looking at ActivePeriodsEarnedMH and if it is blank (ISBLANK) return 0

    mEarnedCum =
    IF (
    ISBLANK (PBIScheduleSummaryPeriod[ActivePeriodsEarnedMH]),
    0,
     CALCULATE (
        SUM ( PBIScheduleSummaryPeriod[ActivePeriodsEarnedMH] ),
        FILTER (
            ALLSELECTED ( PBIScheduleSummaryPeriod ),
            PBIScheduleSummaryPeriod[PeriodID] <= MAX ( PBIScheduleSummaryPeriod[PeriodID] )
        )
     )
    )

    Hope this helps

     

    David