nikhilboorla Posted April 21, 2021 Report Posted April 21, 2021 I have table like this Ticket Date |Total Tickets Created | Pending Tickets ------------------------------------------------------ 01-04-2021 |5000 | 200 02-04-2021 |2000 | 100 03-04-2021 |3000 | 300 select t.created_date,t.source,t.ticket_type, count(*) as Total_Tickets_Created, sum(case when tch.before='Pending Credential' then 1 else 0 end) as Pending_Tickets, from r4e_mongo.mongo_repbiz_tickets t join r4e_mongo.mongo_repbiz_ticket_changelog tch on t.id=cast(tch.ticket_id as string) I want to get Pending Tickets Backlog until the previous day like below to create a report in google data studio with date filter. Ticket Date |Total Tickets Created | Pending Tickets | Pending Tickets Backlog --------------------------------------------------------------------------------- 01-04-2021 |5000 | 200 | 1000 02-04-2021 |2000 | 100 | 1100 --(1000+100) 03-04-2021 |3000 | 300 | 1400 --(1100+300) For example...i have selected October 15th date in report...it should show pending tickets backlog count until October 14 Quote
8pm Posted April 21, 2021 Report Posted April 21, 2021 3 hours ago, nikhilboorla said: I have table like this Ticket Date |Total Tickets Created | Pending Tickets ------------------------------------------------------ 01-04-2021 |5000 | 200 02-04-2021 |2000 | 100 03-04-2021 |3000 | 300 select t.created_date,t.source,t.ticket_type, count(*) as Total_Tickets_Created, sum(case when tch.before='Pending Credential' then 1 else 0 end) as Pending_Tickets, from r4e_mongo.mongo_repbiz_tickets t join r4e_mongo.mongo_repbiz_ticket_changelog tch on t.id=cast(tch.ticket_id as string) I want to get Pending Tickets Backlog until the previous day like below to create a report in google data studio with date filter. Ticket Date |Total Tickets Created | Pending Tickets | Pending Tickets Backlog --------------------------------------------------------------------------------- 01-04-2021 |5000 | 200 | 1000 02-04-2021 |2000 | 100 | 1100 --(1000+100) 03-04-2021 |3000 | 300 | 1400 --(1100+300) For example...i have selected October 15th date in report...it should show pending tickets backlog count until October 14 select ticket date, total_tickets_created,pending_tickets ,sum(pending_tickets) over(order by date) as pending_tickets_backlog from mongo_repbiz_tickets  1 1 Quote
nikhilboorla Posted April 22, 2021 Author Report Posted April 22, 2021 8 hours ago, 8pm said: select ticket date, total_tickets_created,pending_tickets ,sum(pending_tickets) over(order by date) as pending_tickets_backlog from mongo_repbiz_tickets  worked..thanks.. Quote
8pm Posted April 22, 2021 Report Posted April 22, 2021 15 minutes ago, nikhilboorla said: worked..thanks.. Aithe like kottu 1 Quote
nikhilboorla Posted April 22, 2021 Author Report Posted April 22, 2021 5 hours ago, 8pm said: Aithe like kottu will it work for any date? for ex. if i select oct 13th in date filter,it should show pending ticket count until oct 12.. Quote
8pm Posted April 22, 2021 Report Posted April 22, 2021 4 hours ago, nikhilboorla said: will it work for any date? for ex. if i select oct 13th in date filter,it should show pending ticket count until oct 12.. Adhi running sum it keeps on adding that’s it. now you have to chose filters wisely Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.