Forum Discussion
josephc
9 years agoFrequent Visitor
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...
- 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
dedelman_clng
Community Champion
9 years agoTry 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
josephc
9 years agoFrequent Visitor
You got me there I just had to figure out what to use in the isblank.
I made a measure that simply counts the rows in each period, the massive aggregation of data behind the scenes elimiates the chances for mid project blanks and cleanly addresses the remaining project periods.
mEarnedCum =
IF (
ISBLANK ([EarnedMHPeriodCount]),
0,
CALCULATE (
SUM ( PBIScheduleSummaryPeriod[ActivePeriodsEarnedMH] ),
FILTER (
ALLSELECTED ( PBIScheduleSummaryPeriod ),
PBIScheduleSummaryPeriod[PeriodID] <= MAX ( PBIScheduleSummaryPeriod[PeriodID] )
)
)