Forum Discussion

smsayedee's avatar
smsayedee
Copper Contributor
May 30, 2023
Solved

Help needed - filter, power queries and pivot

Hi All,

 

I've a table with below details:

Column A: Activity Name

Column B: Start Date

Column C: End Date

 

Now an activity can be completed in a day, so the start and end date are the same or it can even span over few months. Is there a way I can create a filter where it would list all the months where there is/are activity(s) occurring (in MMMM YYYY format) and when I select a month from that filter it would return the activities that are occurring that month. For example, if Activity1 has a start date 13/05/2023 and end date 15/07/2023 then there would be May 2023, June 2023 and July 2023 in the filter and even if I click June the activity would appear as the month June 2023 falls between the start and end date of that activity. 

 

Please note, I can't use any macro and probably only limited to excel (office 365) with power query.

 

Any idea would be highly appreciated as I'm learning excel. Thank you 🙂

14 Replies

    • smsayedee's avatar
      smsayedee
      Copper Contributor
      Thank you so much for this, however, if some of the startDate cells and/or endDate cells are empty, then could you please advise how to write the GetPeriods function so that it doesn't return an error ('can't convert null value to date')? many thanks in advance 🙂
      • Lorenzo's avatar
        Lorenzo
        Silver Contributor

        There's probably something to do. However, what "MMMM yyyy" - or any other value i.e. null - should be returned in such a case?

Resources