Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

List.Dates between dates

Hi All   I've got a problem I need help with.   I'm trying to plot on a bar chart months/yr on the horizontal axis and value on the Y. I have a project table that has start and end dates on it. I...
  • v-sihou-msft's avatar
    8 years ago

     

    Anonymous 

     

    As error messaged said, you must keep a "Duration" type data within Duration.Days() function. Based on your logic, when [Project Summary.Practical Completion Date] is null, it will return [Project Summary.Ending Date] which is Date type. 

     

    In your scenario, I think you should use Duration.From() in your Duration.Days() part. 

     

    Duration.Days(Duration.From(if [Project Summary.Practical Completion Date] = null then [Project Summary.Ending Date]-[Project Summary.Starting Date] else [Project Summary.Practical Completion Date]-[Project Summary.Starting Date]))+1

     

    Please refer to a slimilar thread: 

     

    https://social.technet.microsoft.com/Forums/en-US/af9dbbf7-2f13-41f3-9a51-7c5d6db1ee9d/datediff-in-power-query?forum=powerquery

     

    Regards,