Quantcast
Channel: AssetWise ALIM
Viewing all articles
Browse latest Browse all 6419

Blog Post: eQL Example for Extracting Fiscal Year and Quarter From a Date Field

$
0
0
Here is a sample report that converts a date field to quarter and fiscal year values START WITH Document SELECT Id, CASE CAST (DateEffective AS STRING, 'MM')  WHEN '10' THEN 'Q1'  WHEN '11' THEN 'Q1'  WHEN '12' THEN 'Q1'  WHEN '01' THEN 'Q2'  WHEN '02' THEN 'Q2'  WHEN '03' THEN 'Q2'  WHEN '04' THEN 'Q3' WHEN '05' THEN 'Q3' WHEN '06' THEN 'Q3' WHEN '07' THEN 'Q4' WHEN '08' THEN 'Q4' WHEN '09' THEN 'Q4' ELSE 'ERROR' END quarter, 'FY' + CAST ( CASE CAST (DateEffective AS STRING, 'MM')  WHEN '10' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) + 1 WHEN '11' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) + 1 WHEN '12' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) + 1 WHEN '01' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '02' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '03' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '04' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '05' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '06' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '07' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '08' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) WHEN '09' THEN CAST(CAST (DateEffective AS STRING, 'YYYY') AS INTEGER) ELSE 0 END AS STRING) FY WHERE IsTemplate = 'N' AND DateEffective IS NOT NULL

Viewing all articles
Browse latest Browse all 6419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>