Skip to content

Instantly share code, notes, and snippets.

@pogilvie
Last active June 26, 2018 15:30
Show Gist options
  • Save pogilvie/94e85f2b315d8b9a0111e3bccd641ac8 to your computer and use it in GitHub Desktop.
Save pogilvie/94e85f2b315d8b9a0111e3bccd641ac8 to your computer and use it in GitHub Desktop.
select calendar_month(Lease_End__c), count(Name), sum(Suite_Area__c)
from Lease__c
where Suite__r.Building__r.Asset__r.InvestmentVehicle__r.Name like '%IV' and
      Lease_End__c > today and
      Lease_End__c < next_year
group by calendar_month(Lease_End__c)
order by calendar_month(Lease_End__c)
month number leases expire total suite Area
6 2 8457
7 4 7312
8 2 6339
10 6 36675
12 3 33378
select name, Lease_End__c, Suite_Area__c
from Lease__c
where Suite__r.Building__r.Asset__r.InvestmentVehicle__r.Name like '%IV' and
      Suite__r.Building__r.Asset__r.Name != 'Asset Not Assigned' and
      Suite__r.Building__r.Asset__r.Asset_Status__c = 'Active' and
      calendar_month(Lease_End__c) = 6 and 
      calendar_year(Lease_End__c) = 2018
Name Lease_End__c Suite_Area__c
IC Compliance LLC 2018-06-14 5119.0
Berkeley Emergency Medical Group, Inc. 2018-06-30 3338.0

What is the Lease expiring sq ft in 6/2018 for DivcoWest IV? 8.457 sq ft

select sum(Suite_Area__c)
from Lease__c
where Suite__r.Building__r.Asset__r.InvestmentVehicle__r.Name like '%IV' and
      (not Suite__r.Building__r.Asset__r.Name like 'TPG-') and
      Suite__r.Building__r.Asset__r.Name != 'Asset Not Assigned' and
      Suite__r.Building__r.Asset__r.Asset_Status__c = 'Active' and
      calendar_month(Lease_End__c) = 6 and 
      calendar_year(Lease_End__c) = 2018

8457

How many records are there of each asset type?

  select RecordType.Name, count(RecordTypeId)
    from Asset__c
group by RecordType.Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment