The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I would like to show cumulative sum for all month until current month in a table visual or a line chart but the data might have some months missing and I would still like to show them in the visuals.
For example, a sample data could be like below,
Here you can see there are no data for April and no data after June, but in PowerBI, I would still like to show cumulatives for those months, something like below,
Thank you.
@anom As a best practice, add a date dimension in your model and use it for time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools. Check the related videos on my YT channel
Add Date Dimension
Importance of Date Dimension
Time Intelligence Playlist
Now add the following measure for cumulative total until the last transaction date (you can tweak it whatever you want) to make it work:
RT Sales =
VAR MaxSalesDate = CALCULATE ( MAX ( 'Calendar'[Date] ), Sales )
VAR RT =
CALCULATE (
[Sales],
FILTER (
ALLSELECTED ( 'Calendar'[Date] ),
'Calendar'[Date] <= MAX ( 'Calendar'[Date] ) &&
'Calendar'[Date] <= MaxSalesDate
)
)
RETURN RT
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi,
Ensure that you have a Calendar Table with calculated column formulas for Year, Month name and Month number. Sort the Month name by the Month number. To your visual, drag Year and Month name from the Calendar Table. Write these measures
Total = sum(Data[Sales])
Total YTD = calculate([Total],datesytd(calendar[date],"31/12"))
Hope this helps.
Hi, ytd resets running total for a new year, need the running total to continue as data will have many years. Thank you
Revise the YTD measure to
Total YTD = calculate([Total],datesbetween(calendar[date],minx(all(calendar),calendar[date]),max(calendar[date])))
Hi, this is showing running total for every single day/month for the date table. Is it possible to show for a specific date range?? (I will need to have a larger date range for date table for real use case and can not show the running total for every single one)
For example, I want to show only upto current month. There might be more lines with different date ranges but would like this line to be just until today. Thank you.
Expand the filter pane and apply a date filter.
@anom do you have a date dimension in your model? What is your running total measure look like?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.