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
efowler
Helper II
Helper II

Cumulative (Running Total) total year over year comparison using year not in the DATE Table

Hello, I cam struggling to figure out how to model this and write the DAX..  Can anyone help? 

 

My desired output is a line graph showing year over year cumulative total for "Net Warranty".  I am able to calculate the running cummulative total but I need it broken up by the 'Warranty'[date recieved] Year in which each year for date recieved is starts over at zero and the running total accumluates for that "date recieved" year. 

 

Line Graph X Axis = Calendar Month from date recieved column

Line Graph Y Axix = Running Total of "net warranty"

Legend = Year from the "Date recieved" column in the warranty table 

 

PBIX file is availalbe for download --> https://app.box.com/s/02tyg0aqr9etf8e94mvls5e4hpkekax9

 

1 ACCEPTED SOLUTION

Hi @efowler ,

You got to build a summary table using the above created measure. The DAX is as below

newtable = ADDCOLUMNS(SUMMARIZE(Warranty,Warranty[Date Recvd], "@MonthNO", MONTH(Warranty[Date Recvd]), "@MONTH", SWITCH(MONTH(Warranty[Date Recvd]),1,"Jan",2,"Feb",3, "Mar", 4, "Apr", 5, "May", 6, "Jun", 7, "Jul", 8, "Aug", 9, "Sep", 10, "Oct", 11, "Nov", 12, "Dec"), "@YEAR", YEAR(Warranty[Date Recvd])), "running_net_warranty", 'Measure'[running_net_warranty])

The Table will look like as below

Thejeswar_1-1646664992826.png

 

Build a graph using this

Thejeswar_2-1646665035705.png

In the graph sort the Month column with Month No

Hope this solves what you wnat!! If this answers, Mark it as solution!! Appreciate a Kudo!!

 

Regards,

View solution in original post

15 REPLIES 15
parry2k
Super User
Super User

@efowler ouch, not something I would do, but if it works for you, good. This is not a scalable and the right approach. I will leave it here.



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.

parry2k
Super User
Super User

@efowler here is the link to the video and yes channel is still PeryTUS youtube.com/perytus

 

https://youtu.be/6lGQKACZbNk



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.

parry2k
Super User
Super User

@Thejeswar This solution works but it will not work as soon as you filter anything in the date dimension because it is not using the Date dimension. 

 

Although the solution which I'm talking about is making sure that we are taking advantage of Date/Calendar dimension so that everything works as expected even if we use anything from the calendar dimension as a slicer, maybe that is not a need for this question but still it is always good to have a scalable solution. Just my 2 cents.



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.

Thank you both for your support...   The measure works in the table but as @parry2k  mentions it does not work whith added filter/date diminsion.    Any suggestions? 

 

Running total 07MAR.jpg

Hi @efowler ,

I modified the DAX a bit and I see it is now giving the right results


1. Created a new column based on Date received to give me Year received in the warranty table

Year received = YEAR(Warranty[Date Recvd])

2. Create a new running total measure as like shown below

running_net_warranty = 
IF(HASONEFILTER(Warranty[Date Recvd]), CALCULATE([Net Warranty], Warranty[Date Recvd] <= MAX(Warranty[Date Recvd]), GROUPBY(Warranty,Warranty[Year received])))

 

The Below is the table and chart

Thejeswar_0-1646659187271.png

Having only the running net warranty measure to clearly show it

Guess this is what you expected.

 

Regards,

@Thejeswar - Getting closer!   What I am trying to show is comparison year over year similar to the below.  

 

Running total example.jpg

Hi @efowler ,

You got to build a summary table using the above created measure. The DAX is as below

newtable = ADDCOLUMNS(SUMMARIZE(Warranty,Warranty[Date Recvd], "@MonthNO", MONTH(Warranty[Date Recvd]), "@MONTH", SWITCH(MONTH(Warranty[Date Recvd]),1,"Jan",2,"Feb",3, "Mar", 4, "Apr", 5, "May", 6, "Jun", 7, "Jul", 8, "Aug", 9, "Sep", 10, "Oct", 11, "Nov", 12, "Dec"), "@YEAR", YEAR(Warranty[Date Recvd])), "running_net_warranty", 'Measure'[running_net_warranty])

The Table will look like as below

Thejeswar_1-1646664992826.png

 

Build a graph using this

Thejeswar_2-1646665035705.png

In the graph sort the Month column with Month No

Hope this solves what you wnat!! If this answers, Mark it as solution!! Appreciate a Kudo!!

 

Regards,

Nailed it!  Thank you very much! 

parry2k
Super User
Super User

@efowler Got it. It is an interesting question and I'm going to do a video on this and post it on my YT channel. Stay tuned. Do subscribe to stay up to date, once the video is ready I will surely post the link here as well.

 

BTW, in the excel sheet for 2022, you entered the wrong data in the table from which you created the line chart.

parry2k_0-1646587781891.png

 

 

Cheers,

 



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.

Thank you..  Is your YouTube channel still PeryTUS? 

 

https://www.youtube.com/channel/UCOYOaONaLGxtHQZxKosUegA

Thejeswar
Resident Rockstar
Resident Rockstar

Hi @efowler ,

If you are looking for running total, I suspect that won't give the right values.

Your recovery measure is giving $81 through out for all date received, although there is no match for that particuar market. Here's the ss

Thejeswar_0-1646509821288.png

 

Do check it out!!

 

Whoops, sorry about that..   I had a couple errors in my sample data and relationships...  I fixed that issue now and have the new .pbix in the link below.    Also have an example of the desired output in the excel file. 

 

https://app.box.com/s/02tyg0aqr9etf8e94mvls5e4hpkekax9

 

Hi @efowler ,

You can use the below DAX to get the Net Waranty running total based on the Data received column in warranty

running_net_warranty = 
CALCULATE([Net Warranty], DATESYTD(Warranty[Date Recvd]))

 

I saw the expected output in excel that you shared. This one matches with it. After the measure is created, set the decimal places to 0

 

Below is the screenshot

Thejeswar_0-1646589557203.png

 

 

Hope this  helps!! Mark it as solution, if this is the excepted!! Appreciate a Kudo!!

parry2k
Super User
Super User

@efowler is this what you are looking for?

parry2k_0-1646508146948.png

 

 

 

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

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.

No, the desired output is shown below..     New .pbix file (corrected file) is in the link below..

 

https://app.box.com/s/02tyg0aqr9etf8e94mvls5e4hpkekax9

 

Running total example.jpg

 

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.