Forum Discussion
Cumulative sum required based on two measures - help required
kskumar , Simply create a cumulative measure for that
example by using sales table
Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])))
Cumm Based on Date = CALCULATE([Net], Window(1,ABS,0,REL, ALL('date'[date]),ORDERBY('Date'[date],ASC)))
Running Total/ Cumulative:
https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=42
You can also consider new visual calc runningsum
Master Visual Calculations in Power BI- February 2024 Update RUNNINGSUM, RANGE, MOVINGAVERAGE, COLLAPSE, COLLAPSEALL, EXPAND, EXPANDALL, FIRST, LAST, PREVIOUS, and NEXT
https://www.youtube.com/watch?v=bKD9T0EWgQo&list=PLPaNVDMhUXGYo50Ajmr4SgSV9HIQLxc8L
- kskumar2 years agoFrequent Visitor
Hi amitchandak ,
Thanks for your response. I tried creating a measure as you suggested and captured the screenshot below. Unfortunaltely, not getting the result that I need.
----------------------------------------------------------------------------------
ActualsFullYearsinceInception =VAR selmonth = MAX(DateTable[MonthNumber])VAR selfiscalYrSort = MAX(DateTable[FiscalYearSort])VAR PrevYr = CALCULATE(SUM(CostCtrlNew[Actual and Forecast]), FILTER(All(DateTable),DateTable[FiscalYearSort] < selfiscalYrSort))VAR CurYr = CALCULATE(SUM(CostCtrlNew[Actual and Forecast]), FILTER(ALL(DateTable),DateTable[FiscalYearSort] = selfiscalYrSort && DateTable[MonthNumber] = selmonth))RETURN PrevYr+CurYr-----------------------------------
CumSum =CALCULATE([ActualsFullYearsinceInception],WINDOW(1,ABS,0,REL,ALL(DateTable),ORDERBY(DateTable[Date],ASC)))Have attached the PBIX file for your reference as well. What I need is the cumulative sum for the actuals listed as the last column.
https://drive.google.com/file/d/1mxV_ljuWwT70TCpfIbu7i0Ch-TLqLwA_/view?usp=sharing
Thank you.