Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Picklingjeff
Regular Visitor

Cumulative Total from A Count of Non Numerical Data (String)

Hello everyone. I'm a new user here, and struggling to get to grips with things.

 

My data is a list of events by date. The events are categorized into 16 categories. In my report I was previously using TOTALYTD quite successfully to do what I want. I set the base value to 'count of the value' and then I could see the number of cases build up over time by each category. However, at the start of January the total reset and I don't want it to do that.

 

Screenshot_46.png

 

I don't mind if it didn't reset at all, the the cumulative total just kept increasing. Then I could filter it for the period of time I am interested in.

 

Even better would be a similar TOTALYTD except the roll over occurred in August and not January.

 

I really don't know and would appreciate any help. Thanks in advance.

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Picklingjeff assuming you have date dimension in your model, if not then you should add one, check my post here.

 

your dax measure would be:

 

Cumulative Total = 
CALCULATE ( COUNTROWS ( Table ), FILTER ( ALL ( DateTable[Date] ), DateTable[Date] <= MAX ( DateTable[Date] ) ) )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@Picklingjeff assuming you have date dimension in your model, if not then you should add one, check my post here.

 

your dax measure would be:

 

Cumulative Total = 
CALCULATE ( COUNTROWS ( Table ), FILTER ( ALL ( DateTable[Date] ), DateTable[Date] <= MAX ( DateTable[Date] ) ) )

 

Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



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.

Thanks so much for all your quick responses.

 

@parry2k I do have a calendar table in my model.

 

I tried your solution and it works much better than I could get, however my issue is that the total runs until the end of 2021. I would like the latest date be the latest date with information. 

 

Screenshot_47.png

So you can see that after the current date there is nothing adding to the total so the values run constant until Dec2021.

 

Is this a case that through my trials and messing with it, I have added dates in my calendar table until the end of the year? Can I just simply delete the rows? Is the MAX(DateTable[Date]) contain entries that go beyond the current date?

 

@amitchandak I took a look at your solution. Thanks for that. However, my data is not numerical and so I cannot SUM anything. I tried before doing a few ways to use that and SUMX but I kept getting the same error that the value is a string.

I figured out my own problem eventually. I have future/past as a flag in my calendar table so I could filter the visual. I also learned how to include it in a measure as well thanks to Guy In A Cube.

 

Thanks everyone. Solved!

amitchandak
Super User
Super User

@Picklingjeff , Try a measure like

Cumm Sales = CALCULATE(SUM(Table[value]),filter(allselected(Table),Table[Date] <=max(Table[Date]) && Table[category] =max(Table[category])))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.