Search code examples
google-sheetsgoogle-query-language

Date base data sheet generation from master sheet


I have one google sheet with two tabs one the master named "All Week Revenue - MasterSheet" where the importrange data will get updated date wise regularly of our sales team. I need the individual sales count along the total sales volume (TSV) and deposit amount (DP Amount) to a new tab named "DAILY SALES COUNT". based on the dates.

here is the sample link for the google sheet:

https://docs.google.com/spreadsheets/d/1b9w61Xa9nMt2bJAHWHBBHE2j7LzF7_E1GcCWWcqAo6U/edit#gid=820688094

I have mentioned how the output should be in "DAILY SALES COUNT" tab.

From master sheet I need only info from cell A, B, D, G & H.

where A & B are name of Manager and sales person, D is TSV, G is DP Amount and H is Dates.

I need the count of TSV column D followed by values of D and G

I tried pivot however is gives me the count of per day sales but the TSV and DP amount is showing only the grand total and not date wise. Tried Vlookup with my little knowledge not of no use.


Solution

  • Here's one approach added to your test sheet:

    =let(Σ,'All Week Revenue - MasterSheet'!A2:H12, a,index(Σ,,1),b,index(Σ,,2),d,index(Σ,,4),g,index(Σ,,7),h,index(Σ,,8),Λ,sort(unique(tocol(h,1)),1,),
     x,vstack(,{"MANAGER","BDA E-MAIL"},unique(filter({a,b},a<>""))),
     reduce(tocol(,1),sequence(rows(x)),lambda(i,c,ifna(vstack(i,let(Δ,chooserows(x,c), hstack(Δ,reduce(torow(,1),Λ,lambda(f,q,hstack(f,if(+Δ="",hstack(text(q,"mm-dd-e"),,),if(+Δ="MANAGER",hstack("Count","TSV","DP"),let(z,join(,Δ),index(let(Ξ,hstack(countifs(h,q,a&b,z),sum(ifna(filter(d,h=q,a&b=z))),sum(ifna(filter(g,h=q,a&b=z)))),if(Ξ=0,,Ξ))))))))))))))))
    

    enter image description here

    • Change the range from 'All Week Revenue - MasterSheet'!A2:H12 to 'All Week Revenue - MasterSheet'!A2:H when you are implementing it in real.