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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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: 

Running Total =
CALCULATE(
COUNT(t_divers_sinistres[sinistre_numero]),
FILTER
(ALLSELECTED(Calendar),
Calendar[Date].[Date]<= MAX(Calendar[Date].[Date]))).
 
I can't restrict this to one specific year. 
 
In fact I would like to obtain a chart like this : 
 
ihoumel_0-1623156163068.png

 

Is there a way to achieve this in dax ? 

 

Thank you 

 
1 ACCEPTED SOLUTION
parry2k
Super User
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.



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

6 REPLIES 6
parry2k
Super User
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.



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.

Anonymous
Not applicable

Hi @parry2k,

 

It's exactly what I wanted ! Thank you very much 

parry2k
Super User
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.

 



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.

Anonymous
Not 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.

 

ihoumel_0-1623616911274.png

Do you know why ? 

v-yalanwu-msft
Community Support
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)?

Anonymous
Not 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 ? 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.