Forum Discussion
POWERBI Desktop - Running total per column
Hi, I have the following table
The desired result is the total for the selected month containing the sum of all previous columns (per customer)
For example if I select Feb (in a filter in my report) the result must be
If I select Mar the result must be
and so on
Thanks,
Hi pceglie,
I have tested it by using the sample data below(Table name:Table1).
And then create a new table by using the DAX below.
Table = SUMMARIZE(Table1,Table1[MonthName],Table1[Customer],"Monthtotal",CALCULATE(SUM(Table1[Rev]),ALLEXCEPT(Table1,Table1[MonthName],Table1[Customer])))Add a running total column by using the DAX below.
RunningTotal = CALCULATE(SUM('Table'[Monthtotal]),FILTER(ALLEXCEPT('Table','Table'[Customer]),'Table'[MonthNumber]<=EARLIER('Table'[MonthNumber])))Then use a martix visual to display the data like below.
Regards,
Charlie Liao
4 Replies
- MattAllingtonCommunity Champion
When you load the data into power bi, you should unpivot it first. Your table will then look like this
customer, month, value
From there you can place customer and month as you need. Do you know how to do this?
- pceglieResolver I
Thanks for your reply,
the data in my table are not pivoted.
Here is an example
Thanks
- MattAllingtonCommunity Champion
so you want a year to date formula? create a calendar table (read about that here http://exceleratorbi.com.au/power-pivot-calendar-tables/)
Then you can use the formula
=TOTALYTD(table[rev],calendar[date])