Search code examples
google-sheetspivotgoogle-sheets-formulaspreadsheetgoogle-query-language

How to generate a monthly report using 1 formula at A2


I am trying to build a monthly report. How can I write 1 formula at A2 to show Monthly Expense Summary.

I want months to show in a descending order. (May April March February January)

Thanks a lot.

enter image description here

https://docs.google.com/spreadsheets/d/1vWxcEN4bW-4pt4ZCOhX1VUsT7bPzmUhf9edeNJ-iB-s/edit?usp=sharing


Solution

  • try:

    =ARRAYFORMULA(REGEXREPLACE(QUERY({TEXT(13-TEXT(Data!A2:A, "m"), "000")&
     TEXT(Data!A2:A, "×mmmm"), Data!A2:C}, 
     "select Col3,sum(Col4) where Col4>0 group by Col3 pivot Col1")&"", "^\d+×", ))
    

    enter image description here