Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Ive had a great read all the resources I can but I am coming up short on a solution to this one.
Have read https://www.daxpatterns.com/cumulative-total/ amongst many other pages.
Im wanting to use a Cumulative Total inside a Line Graph, BUT with a Legend.
Without the legend I have everything working well using
Solved! Go to Solution.
Hi @shaunwilks ,
I got what you want, I think below is that:
CALCULATE(sum(Table1[SALES]), FILTER(ALL(Table1[Date]),Table1[Date] <= MAX(Table1[Date])))
Aiolos Zhao
Hi @shaunwilks ,
Do you mean you want to ignore the filter about the "Item Code"?
If yes, please try to use below DAX:
Calculate(your measure,ALL([Item Code]))
Thanks.
Aiolos Zhao
Thanks for the suggestion but that will result in 1 single solid line.
If you had....
ITEM...SALES...Date
A 40 01/01/2019
A 20 01/03/2019
B 20 01/06/2019
A 60 01/11/2019
C 70 01/12/2019
If I was to just use the measure I put above, with the date along the x axis, into a line graph it shows 1 single line for total sales. Its starting point is 40 in 01/01/2019 and its ending point is 210 in 01/012/2019.
If I drag the ITEM column into the legend I then want a line per item.
But when I do this, the measure I was using before shows a cumulative total for ALL Items, not specific to the cumulative total for the individual lines that represnet wach item code.
So I have three lines, that all end up in December with a value of 210.
I want the cumulative total to represent the individual Item code that each line in the line graph is.
Thanks in advance for any other assistance
Hi @shaunwilks ,
I got what you want, I think below is that:
CALCULATE(sum(Table1[SALES]), FILTER(ALL(Table1[Date]),Table1[Date] <= MAX(Table1[Date])))
Aiolos Zhao
Thanks so much for your time in helping on this one.
I have that working - The one slight hitch is that I have a Calendar table that joins to the Sales table in your sample above.
1) Could you advise what adjustments Id need to make if the Date along the x-axis was sourced from a Date Calendar?
2) It may be pushing it but could you explain how the formula you provided works. Why doenst specifying the date column work in that instance.
1) I think if you can use merge query in the power query editor, to merge the date into your sales table, then you can use the solution directly, or you can try to use the expression just change the table name. please try.
2) to be honest, i'm also new to power bi, I'm not sure whether I can explan it clearly. In my mind, if you use allselected(table), you will ignore the item code, but you want to split the cumulative by item code, so it's enough to only use all(date).
And could you please mark my reply as accepted solution? so other person will know this topic is solved.
Thanks.
Aiolos Zhao
1) I think if you can use merge query in the power query editor, to merge the date into your sales table, then you can use the solution directly, or you can try to use the expression just change the table name. please try...
Dont want to merge as I have a date slicer across multiple pages that I want to apply.
So it has to be the Date Calendar - Ive tried everything with it as the table and dotn have it working unfortunatley.
Ill flag as solution However if anyone can tweak the formula given to achieve what I required please feel free to respond
if it doesn't work by change the table name in DAX, I think the problem is the relationship between these 2 tables, if you can give a small sample about your data including relationship key, I can try to find out the reason.
Aiolos Zhao
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
128 | |
76 | |
50 | |
37 | |
35 |
User | Count |
---|---|
204 | |
80 | |
72 | |
54 | |
48 |