Forum Discussion

satishgupta's avatar
satishgupta
Frequent Visitor
7 years ago
Solved

aggregation

What I want to do

-----------------------

I want to group/aggregate monthly data by client into annual data by client. I can do it, if the year is calendar year. The problem comes when I want to aggregate based on Fiscal year that goes from July to June.

 

How I did calendar year aggregation?

------------------------------------------------

Month is one of the columns in my table. I used “Group By” function in Query and selected aggregation based on that monthly column.

 

The issue with Fiscal Year aggregation

-------------------------------------------------

If fiscal year information was in the same table as revenue, I could do exactly what I did for calendar year aggregation. The problem is that fiscal year information is in a separate table that assigns each month to a fiscal year.

 

How can I accomplish what I am trying to do?

 

Thanks.

Satish

  • edhans's avatar
    edhans
    7 years ago

    If it works for you that is great! It is like so many things in Excel or Power BI - there are a number of ways to come at solving the problem. As long as you find one that works, go forward with it.

6 Replies

  • edhans's avatar
    edhans
    Community Champion

    You need to assign each month the month number it is for their fiscal year. So for calendar year, January is 1, December is 12. For the fiscal year customer, in your example, July is 1, June is 12.

     

    Then aggregate by that month number, but keep the dates in your aggregation if you want to split it back out and identify February as February, regardless if it is month 2 for one customer or month 8 for another.

    • satishgupta's avatar
      satishgupta
      Frequent Visitor
      Thank you.

      How would I handle multiple years? I also keep adding new months. Is there a way to make it dynamic so that it automatically handles additional months?

      I just thought of an indirect way of doing it using your suggestion, but if there is an easier way, I would like to use that.

      Thanks again.
      Satish
      • edhans's avatar
        edhans
        Community Champion

        You would retain the original date in your data, so if you have Feb 1, 2017, Feb 1, 2018, and Feb 1, 2019, those would all be month 2 (or 8)  depending on the cal/fiscal year, but since the year was retained, you would still have the year. 

        I would map this out in Excel in a spreadsheet to get your logic right on how you want it to look and report, then build your Power Query based on that logic by just adding more columns of date information