Forum Discussion

soumyaiyer's avatar
soumyaiyer
Icon for Helper IV rankHelper IV
1 year ago
Solved

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!

 

  • Click here to donwload the solution form Onedrive

    Click here 

     

     

     

    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))

    The get the previous row  value

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

    The get the difference

    Calculate the persentage

     

     

    And change the data type to percentage

     

    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 !

     

     

     

5 Replies

  • Click here to donwload the solution form Onedrive

    Click here 

     

     

     

    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))

    The get the previous row  value

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

    The get the difference

    Calculate the persentage

     

     

    And change the data type to percentage

     

    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 !

     

     

     

  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    Icon for Community Support rankCommunity 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!

  • 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!

  • v-kpoloju-msft's avatar
    v-kpoloju-msft
    Icon for Community Support rankCommunity 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:


    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.

    • soumyaiyer's avatar
      soumyaiyer
      Icon for Helper IV rankHelper IV

      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.