Forum Discussion
Cumulative Total
Please find belowmy screenshot.
My goal is to get the cumul of "Budget Corrige" and "Dep Reelles" for the first to the last day.
Then I wan to be able to get the result for one "IMPUT:PHASE"
Thanks
It will be very helpful if you can share a simplified Excel Workbook that contains sample data.
Here is a link to a post that describes how to create sample data, if it's not possible to share an Excel workbook:
https://community.powerbi.com/t5/Desktop/Please-use-Table-FromRows-to-create-sample-data/m-p/111557
- pierredelareux9 years agoHelper I
- TomMartens9 years agoSuper User
Hey,
sorry for the delay, I had to take care of some other issues :-)
I guess this does the trick:
Budget **bleep** = var maxIndex = calculate(LASTNONBLANK('data'[Index], sum(data[Budget Corrige]))) var minIndex = calculate(FIRSTNONBLANK(all('data'[Index]), sum(data[Budget Corrige]))) return calculate( sum('data'[Budget Corrige]), FILTER(all(data[Index]), 'data'[Index] >= minIndex && 'data'[Index] <= maxIndex) )Here you can find a pbix
Maybe you already know this, but if not it is an excellent read about filtering tables: https://www.sqlbi.com/articles/filtering-tables/
Hope this helps
- pierredelareux9 years agoHelper I
Hi,
I had to adhust your code (filter the sum on table and not column) to get a sum as :
Budget **bleep** = var maxIndex = calculate(LASTNONBLANK('data'[Index], sum(data[Budget Corrige]))) var minIndex = calculate(FIRSTNONBLANK(all('data'[Index]), sum(data[Budget Corrige]))) return calculate( sum('data'[Budget Corrige]), FILTER(all('data'), 'data'[Index] >= minIndex && 'data'[Index] <= maxIndex) )When I select a "IMPUT:PHASE" it doesn't give me right total amount.
Sorry to bother you...
Pierre