Forum Discussion
Running total on specific year
Hi everyone,
I am trying to display on the same chart the running total of the number of my files for 2020 and 2021 and this month by month.
I created a measure that gives me the running total for all years:
Is there a way to achieve this in dax ?
Thank you
Anonymous try this:
Running Total = CALCULATE( COUNT(t_divers_sinistres[sinistre_numero]), DATESYTD(Calendar[Date]) )Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS 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.⚡
6 Replies
- parry2k
Super User
Anonymous try this:
Running Total = CALCULATE( COUNT(t_divers_sinistres[sinistre_numero]), DATESYTD(Calendar[Date]) )Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS 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.⚡
- AnonymousNot applicable
- v-yalanwu-msft
Community Support
Hi, Anonymous ;
I am not very clear about your table, such as what fields your x-axis and legend are? can you provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data .
or provide a simple example (.pbix)?- AnonymousNot applicable
Hi v-yalanwu-msft,
Consider that I have two tables :
The first one is a simple calendar table
The second one contains all my files since 2019 with the name of the file and its date (of creation).
The relation between these two tables is made between the column date of my calendar table and the creation date column of the second table.
I want to display on a same chart the running total of the number of my files for the year 2020 and for the year 2021 (like on the picture above). The x axis would be the month column of my calendar table.
Is that clear ?
- parry2k
Super User
Anonymous make your calendar table as a date table, you can check my blog post here and change your measure like this:
Running Total = CALCULATE( COUNT(t_divers_sinistres[sinistre_numero]), FILTER (ALLSELECTED(Calendar), Calendar[Date]<= MAX(Calendar[Date])))Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS 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.⚡
- AnonymousNot applicable
Thank you parry2k,
But how I can restrict this measure to a specific year ? I added a filter on the year after the
FILTER(ALLSELECTED(Calendar),Calendar[Date]<= MAX(Calendar[Date]))).and the running total starts from 2020 but doesn't stop in 2021. I obtained something like this.
Do you know why ?