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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
soumyaiyer
Frequent Visitor

Calculate change % week on week duration

Hello,

 

Need help to calculate week on week % change with duration as value in power query.

 

Below the matix table with the week number and total duration for each week . 

 

Any help is greatly appreciated! Thanks!

 

Screenshot 2025-06-17 220306.png

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

Click here to donwload the solution form Onedrive

Click here 

 

speedramps_0-1750238935674.png

 

 

Please click thumbs up for me trying to help, because it took a lot of effort.

Then click accept solution if it works. Thank you !

 

How it works ...


The AHT Time has a time data type.
I recommend you convert it to seconds

 

= (Duration.Hours([AHT Time] - #time(0,0,0)) * 60 * 60) +
(Duration.Minutes([AHT Time] - #time(0,0,0)) * 60) +
Duration.Seconds([AHT Time] - #time(0,0,0))

speedramps_1-1750239018535.png

The get the previous row  value

try #"Get AHT seconds" [AHT seconds] { [Week] - 2 } otherwise null

speedramps_2-1750239066427.png

The get the difference

speedramps_3-1750239097484.png

Calculate the persentage

speedramps_4-1750239137529.png

 

 

And change the data type to percentage

speedramps_5-1750239159009.png

 

Please click thumbs up for me trying to help, because it took a lot of effort.

Then click accept solution if it works. Thank you !

 

 

 

View solution in original post

5 REPLIES 5
v-kpoloju-msft
Community Support
Community Support

Hi @soumyaiyer,

Thank you for reaching out to the Microsoft fabric community forum. Also thanks @speedramps, for his insights on this thread. I reproduced the scenario again, and it worked on my end. I used my sample data and successfully implemented it.

outcome:

vkpolojumsft_0-1750264999001.png
I am also including .pbix file for your better understanding, please have a look into it:

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using Microsoft Community Forum.

Hi  v-kpoloju-msft,

 

Thank you for looking into this. I have the date for 3 years, the report is at the agent level broken down in weeks, For some reason the Previous column is not picking up the correct values. The sample data which you shared , I see you have created measures for each week. 

 

Screenshot 2025-06-18 121547.png

soumyaiyer
Frequent Visitor

Hi ,

 

Thank you for the quick help really appreciate.

 

The get the previous row  value is not working could you please review and help me. Thanks!Screenshot 2025-06-18 085748.png

v-kpoloju-msft
Community Support
Community Support

Hi @soumyaiyer,

Thank you for reaching out to the Microsoft Fabric Community Forum. Has your issue been resolved? If the response provided by the community member @speedramps, addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.

If yes, kindly accept the useful reply as a solution and give us Kudos. It would be appreciated.

Thank you for your understanding!

speedramps
Community Champion
Community Champion

Click here to donwload the solution form Onedrive

Click here 

 

speedramps_0-1750238935674.png

 

 

Please click thumbs up for me trying to help, because it took a lot of effort.

Then click accept solution if it works. Thank you !

 

How it works ...


The AHT Time has a time data type.
I recommend you convert it to seconds

 

= (Duration.Hours([AHT Time] - #time(0,0,0)) * 60 * 60) +
(Duration.Minutes([AHT Time] - #time(0,0,0)) * 60) +
Duration.Seconds([AHT Time] - #time(0,0,0))

speedramps_1-1750239018535.png

The get the previous row  value

try #"Get AHT seconds" [AHT seconds] { [Week] - 2 } otherwise null

speedramps_2-1750239066427.png

The get the difference

speedramps_3-1750239097484.png

Calculate the persentage

speedramps_4-1750239137529.png

 

 

And change the data type to percentage

speedramps_5-1750239159009.png

 

Please click thumbs up for me trying to help, because it took a lot of effort.

Then click accept solution if it works. Thank you !

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors