Can you show the total WIP amount by office location for matters?

Instruction:
1) Guidelines
- Objective: Return total WIP amount grouped by office location.
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures: Total WIP Amount → WIPAMT, aggregation SUM, monetary yes, currency column null (assume INR)
- Dimensions: Office
- Temporal filter: Default to last 2 financial years (Apr–Mar, India). SQL-ready: (Year > 2023) OR (Year = 2023 AND Month >= 4)
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Office, SUM(WIPAMT)
- Notes/assumptions: No explicit time frame given; applied default last 2 years on financial-year basis. Currency assumed INR as table lacks a currency column.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "Total WIP Amount", "column": "WIPAMT", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["Office"],
  "filters": ["(Year > 2023) OR (Year = 2023 AND Month >= 4)"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 financial years applied; INR assumed."
}

SELECT
  Office,
  SUM(WIPAMT) AS TotalWIPAmount
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
GROUP BY Office;


give me average realization rate with respect to practice area

Instruction:
1) Guidelines
- 1) Objective: Return average realization rate by practice area (PAName).
- 2) Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- 3) Measures: Average realization rate → AVG(TotalRealised / NULLIF(TotalBilledINR, 0)); aggregation = AVG; monetary = no; currency column = null
- 4) Dimensions: PAName (from the Raised table after join)
- 5) Temporal filter: Default to last 2 financial years. Use Year/Month from Realization table: (Year > 2023) OR (Year = 2023 AND Month >= 4)
- 6) Row filtering: TotalBilledINR > 0
- 7) Sorting and limit: None
- 8) Joins: Join db_owner.NLP_IR_RaisedExcelTracker_tbl to bring PAName. Keys: Realization.BillNumber = Raised.BillNo AND Realization.ClientName = Raised.ClientName AND Realization.FileNo = Raised.FileNo
- 9) Columns to SELECT: PAName, AVG(TotalRealised / NULLIF(TotalBilledINR, 0)) as AvgRealizationRate
- 10) Notes/assumptions: PAName is not present in Realization; using Raised to supply PAName via verified keys. Using financial-year window per default.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "AvgRealizationRate", "column": "TotalRealised * 1.0 / NULLIF(TotalBilledINR, 0)", "agg": "AVG", "monetary": false, "currency_column": "null" }
  ],
  "dimensions": ["PAName"],
  "filters": ["(Year > 2023) OR (Year = 2023 AND Month >= 4)", "TotalBilledINR > 0"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [
    { "table": "db_owner.NLP_IR_RaisedExcelTracker_tbl", "on": ["db_owner.NLP_IR_RealizationExcelTracker_tbl.BillNumber = db_owner.NLP_IR_RaisedExcelTracker_tbl.BillNo", "db_owner.NLP_IR_RealizationExcelTracker_tbl.ClientName = db_owner.NLP_IR_RaisedExcelTracker_tbl.ClientName", "db_owner.NLP_IR_RealizationExcelTracker_tbl.FileNo = db_owner.NLP_IR_RaisedExcelTracker_tbl.FileNo"] }
  ],
  "include_srno": false,
  "notes": "Join to Raised to use PAName; compute average TotalRealised/TotalBilledINR over last 2 financial years."
}

SELECT
  r2.PAName,
  AVG(r1.TotalRealised * 1.0 / NULLIF(r1.TotalBilledINR, 0)) AS AvgRealizationRate
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl AS r1
JOIN db_owner.NLP_IR_RaisedExcelTracker_tbl AS r2
  ON r1.BillNumber = r2.BillNo
 AND r1.ClientName = r2.ClientName
 AND r1.FileNo = r2.FileNo
WHERE r1.TotalBilledINR > 0
GROUP BY r2.PAName;


what were the number of matters created practice wise and location wise since April 2025

Instruction:
1) Guidelines
- 1) Objective: Return the count of matters, grouped by practice area (PAName) and location, for periods since April 2025.
- 2) Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- 3) Measures: Matter Count → Matter, aggregation = COUNT DISTINCT, monetary? no, currency column = null
- 4) Dimensions: PAName, Location
- 5) Temporal filter: “since April 2025” → (Year = 2025 AND Month >= 4) OR (Year > 2025)
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: PAName, Location, Matter Count
- 10) Notes/assumptions: Using COUNT(DISTINCT Matter) to avoid multiple bill rows per matter. Interprets “created” as the first appearance in the Raised tracker; if true matter creation date is required, a different source may be needed.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Matter Count", "column": "Matter", "agg": "COUNT", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["PAName", "Location"],
  "filters": ["(Year = 2025 AND Month >= 4) OR (Year > 2025)"],
  "time_window": { "basis": "financial", "start": "2025-04-01", "end": null, "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Apply COUNT(DISTINCT [Matter]) for the measure to count unique matters."
}

SELECT
  PAName,
  Location,
  COUNT(DISTINCT Matter) AS [Matter Count]
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE (Year = 2025 AND Month >= 4) OR (Year > 2025)
GROUP BY
  PAName,
  Location;


What are the top 5 practices based on the total OS and WIP from april 2025

Instruction:
1) Guidelines
- 1) Objective: Return the top 5 practice areas (PAName) ranked by combined monetary total of OS and WIP from April 2025 onwards.
- 2) Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- 3) Measures:
  - OS Total → [OS INR], SUM, monetary: yes, currency column: [Billing Currency] (assumed INR usage; see note)
  - WIP Total → WIPAMT, SUM, monetary: yes, currency column: null
  - Combined Total (for ranking) → SUM([OS INR]) + SUM(WIPAMT) (calculated; essential to rank)
- 4) Dimensions: PAName
- 5) Temporal filter: “from April 2025” means inclusive onwards: (Year = 2025 AND Month >= 4) OR (Year > 2025). Apply the same filter to both OS and WIP tables; do not use [To Date] since this is a “from” range.
- 6) Row filtering: None beyond the time window.
- 7) Sorting and limit: Order by Combined Total DESC and return top 5.
- 8) Joins: Join db_owner.NLP_IR_OSExcelTracker_tbl (t1) to db_owner.NLP_IR_WIPExcelTracker_tbl (t2) on PAName (t1.PAName = t2.PAName).
- 9) Columns to SELECT: PAName, SUM(t1.[OS INR]) as OS_Total, SUM(t2.WIPAMT) as WIP_Total, (SUM(t1.[OS INR]) + SUM(t2.WIPAMT)) as Combined_Total
- 10) Notes/assumptions: Financial-year basis (Apr–Mar). Amounts treated as INR; OS table has [Billing Currency] but WIP does not, so ranking uses INR totals.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS_Total", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": "[Billing Currency]" },
    { "label": "WIP_Total", "column": "WIPAMT", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["PAName"],
  "filters": [
    "(t1.Year = 2025 AND t1.Month >= 4) OR (t1.Year > 2025)",
    "(t2.Year = 2025 AND t2.Month >= 4) OR (t2.Year > 2025)"
  ],
  "time_window": { "basis": "financial", "start": "2025-04-01", "end": null, "use_to_date_for_os": false },
  "order_by": [{ "expr": "SUM(t1.[OS INR]) + SUM(t2.WIPAMT)", "dir": "DESC" }],
  "top_n": 5,
  "joins": [
    { "table": "db_owner.NLP_IR_WIPExcelTracker_tbl", "on": ["t1.PAName = t2.PAName"] }
  ],
  "include_srno": false,
  "notes": "Ranking based on combined SUM(OS INR) + SUM(WIPAMT) from Apr 2025 onwards; financial-year basis; amounts treated as INR."
}

SELECT TOP 5
  COALESCE(o.PAName, w.PAName) AS PAName,
  COALESCE(o.OS_Total, 0) AS OS_Total,
  COALESCE(w.WIP_Total, 0) AS WIP_Total,
  COALESCE(o.OS_Total, 0) + COALESCE(w.WIP_Total, 0) AS Combined_Total
FROM
  (SELECT
     PAName,
     SUM([OS INR]) AS OS_Total
   FROM db_owner.NLP_IR_OSExcelTracker_tbl
   WHERE (Year = 2025 AND Month >= 4) OR (Year > 2025)
   GROUP BY PAName
  ) AS o
FULL OUTER JOIN
  (SELECT
     PAName,
     SUM(WIPAMT) AS WIP_Total
   FROM db_owner.NLP_IR_WIPExcelTracker_tbl
   WHERE (Year = 2025 AND Month >= 4) OR (Year > 2025)
   GROUP BY PAName
  ) AS w
ON o.PAName = w.PAName
ORDER BY Combined_Total DESC;


List the top 10 users with most idle hours since april 2025

Instruction:
1) Guidelines
- Objective: Return the top 10 users with the highest idle hours accumulated since April 2025.
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures: Idle Hours → BHWIPHRS, aggregation = SUM, monetary = no, currency column = null
- Dimensions: TL
- Temporal filter: “since April 2025” → (Year = 2025 AND Month >= 4) OR (Year > 2025); use Year/Month columns from the WIP table
- Row filtering: None
- Sorting and limit: Sort by SUM(BHWIPHRS) DESC; limit to TOP 10
- Joins: None
- Columns to SELECT: TL, SUM(BHWIPHRS)
- Notes/assumptions: Interpreting “users” as TL (team lead) names. Interpreting “idle hours” as BHWIPHRS (bench/idle WIP hours).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "Idle Hours", "column": "BHWIPHRS", "agg": "SUM", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["TL"],
  "filters": [
    "(Year = 2025 AND Month >= 4) OR (Year > 2025)"
  ],
  "time_window": { "basis": "financial", "start": "2025-04-01", "end": "2099-12-31", "use_to_date_for_os": false },
  "order_by": [{ "expr": "SUM(BHWIPHRS)", "dir": "DESC" }],
  "top_n": 10,
  "joins": [],
  "include_srno": false,
  "notes": "Assumed 'users' = TL; 'idle hours' mapped to BHWIPHRS."
}

SELECT TOP 10
  TL,
  SUM(BHWIPHRS) AS IdleHours
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE ([Year] = 2025 AND [Month] >= 4) OR ([Year] > 2025)
GROUP BY TL
ORDER BY SUM(BHWIPHRS) DESC


provide me all pending bills since 2024 client group and practice area wise.

Instruction:
1) Guidelines
- 1) Objective: Show pending bills (outstanding) since 2024, grouped by client group and practice area.
- 2) Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- 3) Measures: Pending OS → [OS INR], aggregation SUM, monetary yes, currency column [Billing Currency]
- 4) Dimensions: [Client Group], PAName
- 5) Temporal filter: “since 2024” → use Year >= 2024 (financial-year default). SQL-ready: Year >= 2024
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: [Client Group], PAName, SUM([OS INR]) as PendingOSINR, [Billing Currency]
- 10) Notes/assumptions: “Pending bills” interpreted as outstanding amounts from OS table; default financial-year basis applied; using Year for filter (no [To Date] cut-off requested).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "PendingOSINR", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": ["[Client Group]", "PAName"],
  "filters": ["Year >= 2024"],
  "time_window": { "basis": "financial", "start": "2024-04-01", "end": null, "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Outstanding interpreted via OS INR; grouped by Client Group and PAName; no cut-off date specified so Year filter used."
}

SELECT
  [Client Group],
  PAName,
  [Billing Currency],
  SUM([OS INR]) AS PendingOSINR
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE Year >= 2024
GROUP BY [Client Group], PAName, [Billing Currency];

SELECT [Client Group], PAName, SUM([OS INR]) AS PendingOSINR
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE Year >= 2024
GROUP BY [Client Group], PAName;


Can you give me comparision of raised amount vs realized amount for year 2024 with respect to client group.

Instruction:
1) Guidelines
- Objective: Compare total raised amount vs total realized amount for FY 2024–25 by ClientGroup.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures:
  - Raised Amount → ClientTotalINR, SUM, monetary: yes, currency column: null (values already in INR)
  - Realized Amount → TotalRealised, SUM, monetary: yes, currency column: null (values already in INR)
- Dimensions: ClientGroup
- Temporal filter: Financial Year basis for “year 2024” → Apr 2024 to Mar 2025
  - SQL-ready predicate (apply to both tables): (Year = 2024 AND Month >= 4) OR (Year = 2025 AND Month <= 3)
- Row filtering: None
- Sorting and limit: None
- Joins: Essential — join aggregated totals from Realization table to Raised by ClientGroup (No other keys)
- Columns to SELECT: ClientGroup, SUM(ClientTotalINR) as RaisedAmount, SUM(TotalRealised) as RealisedAmount
- Notes/assumptions: Treat “year 2024” as Financial Year 2024–25 (Apr 2024–Mar 2025). Aggregation must be done per table before joining to avoid duplication.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "RaisedAmount", "column": "ClientTotalINR", "agg": "SUM", "monetary": true, "currency_column": null },
    { "label": "RealisedAmount", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["ClientGroup"],
  "filters": ["(Year = 2024 AND Month >= 4) OR (Year = 2025 AND Month <= 3)"],
  "time_window": { "basis": "financial", "start": "2024-04-01", "end": "2025-03-31", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [
    { "table": "db_owner.NLP_IR_RealizationExcelTracker_tbl", "on": ["db_owner.NLP_IR_RaisedExcelTracker_tbl.ClientGroup = db_owner.NLP_IR_RealizationExcelTracker_tbl.ClientGroup"] }
  ],
  "include_srno": false,
  "notes": "Aggregate totals by ClientGroup in each table for the FY filter, then join to compare raised vs realized."
}

SELECT
  COALESCE(rz.ClientGroup, rl.ClientGroup) AS ClientGroup,
  rz.RaisedAmount,
  rl.RealisedAmount
FROM (
  SELECT
    ClientGroup,
    SUM(ClientTotalINR) AS RaisedAmount
  FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
  WHERE (Year = 2024 AND Month >= 4) OR (Year = 2025 AND Month <= 3)
  GROUP BY ClientGroup
) AS rz
FULL OUTER JOIN (
  SELECT
    ClientGroup,
    SUM(TotalRealised) AS RealisedAmount
  FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
  WHERE (Year = 2024 AND Month >= 4) OR (Year = 2025 AND Month <= 3)
  GROUP BY ClientGroup
) AS rl
  ON rz.ClientGroup = rl.ClientGroup;

SELECT
  COALESCE(rz.ClientGroup, rl.ClientGroup) AS ClientGroup,
  rz.RaisedAmount,
  rl.RealisedAmount
FROM (
  SELECT
    ClientGroup,
    SUM(ClientTotalINR) AS RaisedAmount
  FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
  WHERE Year = 2024
  GROUP BY ClientGroup
) AS rz
FULL OUTER JOIN (
  SELECT
    ClientGroup,
    SUM(TotalRealised) AS RealisedAmount
  FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
  WHERE Year = 2024
  GROUP BY ClientGroup
) AS rl
  ON rz.ClientGroup = rl.ClientGroup;


Instruction:
1) Guidelines
- 1) Objective: Return the single person (interpreted as Team Lead) who logged the highest total WIP hours in the last financial year.
- 2) Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- 3) Measures: TotalHours → WIPHRS, aggregation: SUM, monetary: no, currency column: null
- 4) Dimensions: TL
- 5) Temporal filter: “last year” → last completed financial year Apr 2024–Mar 2025; SQL predicate: (Year = 2024 AND Month >= 4) OR (Year = 2025 AND Month <= 3)
- 6) Row filtering: None
- 7) Sorting and limit: Order by SUM(WIPHRS) DESC; return Top 1
- 8) Joins: None
- 9) Columns to SELECT: TL, SUM(WIPHRS) as TotalHours
- 10) Notes/assumptions: “Who” is taken as Team Lead (TL) given available person fields; adjust to RM if needed.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "TotalHours", "column": "WIPHRS", "agg": "SUM", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["TL"],
  "filters": ["(Year = 2024 AND Month >= 4) OR (Year = 2025 AND Month <= 3)"],
  "time_window": { "basis": "financial", "start": "2024-04-01", "end": "2025-03-31", "use_to_date_for_os": false },
  "order_by": [{ "expr": "SUM(WIPHRS)", "dir": "DESC" }],
  "top_n": 1,
  "joins": [],
  "include_srno": false,
  "notes": "Interpreted 'who' as Team Lead (TL). If a different person field is intended, swap TL for RM."
}

SELECT TOP 1
  TL,
  SUM(WIPHRS) AS TotalHours
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE ([Year] = 2024 AND [Month] >= 4) OR ([Year] = 2025 AND [Month] <= 3)
GROUP BY TL
ORDER BY SUM(WIPHRS) DESC;

SELECT TOP 1
  TL,
  SUM(WIPHRS) AS TotalHours
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE [Year] = 2024
GROUP BY TL
ORDER BY SUM(WIPHRS) DESC;


Retrieve all credit note entries for financial year 2023-24.

Instruction:
1) Guidelines
- 1) Objective: Return all credit note entries for financial year 2023–24 (row-level detail).
- 2) Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- 3) Measures: None (no aggregation; return row details).
- 4) Dimensions: None (no grouping).
- 5) Temporal filter: Financial year Apr 2023–Mar 2024. Use FinYear = '2023-24' for filtering.
  SQL-ready: FinYear = '2023-24'
- 6) Row filtering: None beyond the financial year.
- 7) Sorting and limit: None.
- 8) Joins: None.
- 9) Columns to SELECT: BillNumber, BillDate, ClientName, Matter, FileNo, PAName, Team, Location, CNReason, Curency, Rate, ClientTotalINR, OwnTotalINR, ICTotalINR.
- 10) Notes/assumptions: Using FinYear string match; if the warehouse stores numeric FinancialYear differently, adjust accordingly.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": ["FinYear = '2023-24'"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2024-03-31", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Filter by FinYear string for 2023-24; return row-level credit note details."
}

SELECT
  BillNumber,
  BillDate,
  ClientName,
  Matter,
  FileNo,
  PAName,
  Team,
  Location,
  CNReason,
  Curency,
  Rate,
  ClientTotalINR,
  OwnTotalINR,
  ICTotalINR
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE FinYear = '2023-24';


Show total ClientTotalINR credited per location.

Instruction:
1) Guidelines
- 1) Objective: Return total ClientTotalINR credited per Location.
- 2) Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- 3) Measures: Total ClientTotalINR → ClientTotalINR, aggregation SUM, monetary yes, currency column null
- 4) Dimensions: Location
- 5) Temporal filter: No period specified; use default last 2 financial years (Apr–Mar). SQL-ready: (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: Location, SUM(ClientTotalINR) AS TotalClientTotalINR
- 10) Notes/assumptions: Interpreted “credited” as credit notes; using Credit Note tracker. If receipts were intended, Realization table would be needed.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [
    { "label": "TotalClientTotalINR", "column": "ClientTotalINR", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["Location"],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Assumed 'credited' refers to credit notes; using Credit Note table."
}

SELECT
  Location,
  SUM(ClientTotalINR) AS TotalClientTotalINR
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
GROUP BY Location;


List all credit notes created for client 'ABC Corp'.

Instruction:
1) Guidelines
- Objective: List all credit notes for client 'ABC Corp' within the default last 2 financial years.
- Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- Measures: None
- Dimensions: None (return a row list with key credit-note attributes)
- Temporal filter: Default last 2 years on financial-year basis; use Year/Month mapping:
  (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: ClientName = 'ABC Corp'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: ClientName, BillNumber, BillDate, CNReason
- Notes/assumptions: Time window defaults to last 2 financial years (Apr 1, 2023 to current date); user did not request amounts, so not included.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": [
    "ClientName = 'ABC Corp'",
    "(Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 financial years applied; listing core credit note attributes only."
}

SELECT
  ClientName,
  BillNumber,
  BillDate,
  CNReason
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE ClientName = 'ABC Corp'
  AND ( (Year > 2023 OR (Year = 2023 AND Month >= 4))
        AND (Year < 2025 OR (Year = 2025 AND Month <= 11)) );

SELECT
  ClientName,
  BillNumber,
  BillDate,
  CNReason
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE ClientName = 'ABC Corp';


Find all matters where ICTotalINR exceeds 50,000.

Instruction:
1) Guidelines
- 1) Objective: List all Matter entries where ICTotalINR exceeds 50,000.
- 2) Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- 3) Measures: None (use ICTotalINR only for filtering; monetary yes, no currency column in SELECT)
- 4) Dimensions: Matter
- 5) Temporal filter: Default window (last 2 years, financial basis Apr–Mar). Use Month_StartDate between '2023-11-01' and '2025-11-20'.
- 6) Row filtering: ICTotalINR > 50000
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: Matter
- 10) Notes/assumptions: No explicit time window provided; applied default last 2 years.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [],
  "dimensions": ["Matter"],
  "filters": ["[Month_StartDate] >= '2023-11-01'", "[Month_StartDate] <= '2025-11-20'", "[ICTotalINR] > 50000"],
  "time_window": { "basis": "financial", "start": "2023-11-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Applied default last 2 years window since none specified."
}

SELECT Matter
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE ICTotalINR > 50000;


Show credit notes reversed (BillingStatus='Reversed').

Instruction:
1) Guidelines
- Objective: List all credit note entries where BillingStatus is 'Reversed'.
- Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- Measures: None (no aggregation; non-monetary)
- Dimensions: None (detail rows only)
- Temporal filter: Financial-year basis default (last 2 years: from Apr 2023 to Nov 2025). Use Year and Month columns:
  - ((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- Row filtering: BillingStatus = 'Reversed'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillingStatus, BillNumber, BillDate, ClientName, PAName, Team, Location, CNReason
- Notes/assumptions: Applied default 2-year window using financial-year basis as user did not specify dates.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": [
    "BillingStatus = 'Reversed'",
    "((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year window applied; financial-year basis (Apr–Mar)."

SELECT
  BillingStatus,
  BillNumber,
  BillDate,
  ClientName,
  PAName,
  Team,
  Location,
  CNReason
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE BillingStatus = 'Reversed';


Instruction:
1) Guidelines
- Objective: Return the count of credit notes grouped by BillType.
- Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- Measures: CreditNoteCount → COUNT(*) (aggregation: COUNT, monetary: no, currency column: null)
- Dimensions: BillType
- Temporal filter: Default financial-year basis; last 2 years → use Year/Month. Predicate: (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillType, CreditNoteCount
- Notes/assumptions: Applied default 2-year financial window (Apr–Mar); end capped at Nov 2025 based on current date.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [
    { "label": "CreditNoteCount", "column": "*", "agg": "COUNT", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["BillType"],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year financial window applied; grouped by BillType."
}

SELECT
  BillType,
  COUNT(*) AS CreditNoteCount
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
GROUP BY BillType;


Show credit notes reversed (BillingStatus='Generated Bill').

Instruction:
1) Guidelines
- 1) Objective: List credit notes where BillingStatus is 'Generated Bill' for the default last 2 years.
- 2) Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- 3) Measures: None (no aggregation; non-monetary listing). Monetary not required.
- 4) Dimensions: Location, ClientGroup, ClientName, BillNumber, BillDate, CNReason, PAName, Team, ClientTotalINR, Curency
- 5) Temporal filter: Default window = last 2 years on financial basis. Map to Year/Month: from Nov 2023 through Nov 2025. SQL-ready:
  - ((Year > 2023) OR (Year = 2023 AND Month >= 11)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: BillingStatus = 'Generated Bill'
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: Location, ClientGroup, ClientName, BillNumber, BillDate, CNReason, PAName, Team, ClientTotalINR, Curency
- 10) Notes/assumptions: “credit notes reversed” is interpreted as entries in the Credit Note tracker with BillingStatus='Generated Bill'. No explicit reversal flag exists; CNReason included for context.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [],
  "dimensions": ["Location", "ClientGroup", "ClientName", "BillNumber", "BillDate", "CNReason", "PAName", "Team", "ClientTotalINR", "Curency"],
  "filters": [
    "BillingStatus = 'Generated Bill'",
    "((Year > 2023) OR (Year = 2023 AND Month >= 11)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-11-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 years applied; CNReason included to indicate reversal context."
}

SELECT
  Location,
  ClientGroup,
  ClientName,
  BillNumber,
  BillDate,
  CNReason,
  PAName,
  Team,
  ClientTotalINR,
  Curency
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE BillingStatus = 'Generated Bill';


Show all WIP entries for office 'Delhi'.

Instruction:
1) Guidelines
- Objective: Return all WIP rows for office ‘Delhi’ within the default financial window.
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures: None (no aggregation; show row-level WIP fields)
- Dimensions: None (no grouping requested)
- Temporal filter: Use financial basis default window via Month_StartDate: Month_StartDate >= '2023-04-01' AND Month_StartDate <= '2025-11-20'
- Row filtering: Office = 'Delhi'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Office, ClientGroup, Client, Matter, FileName, TL, RM, Team, TeamOffice, PAName, BillingType, WIPHRS, WIPAMT, BHWIPHRS, BHWIPAMT, [To Date], [Run On], Year, Month, FinancialYear, Month_StartDate, Month_EndDate
- Notes/assumptions: Default window = last 2 years on financial basis; not an “as of” request, so no [To Date]-based cut-off filtering.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": [
    "Office = 'Delhi'",
    "Month_StartDate >= '2023-04-01'",
    "Month_StartDate <= '2025-11-20'"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Show row-level WIP entries for Delhi; default financial window of last 2 years applied."
}

SELECT
  Office,
  ClientGroup,
  Client,
  Matter,
  FileName,
  TL,
  RM,
  Team,
  TeamOffice,
  PAName,
  BillingType,
  WIPHRS,
  WIPAMT,
  BHWIPHRS,
  BHWIPAMT,
  [To Date],
  [Run On],
  Year,
  Month,
  FinancialYear,
  Month_StartDate,
  Month_EndDate
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE Office = 'Delhi'
  AND Month_StartDate >= '2023-04-01'
  AND Month_StartDate <= '2025-11-20';

SELECT
  Office,
  ClientGroup,
  Client,
  Matter,
  FileName,
  TL,
  RM,
  Team,
  TeamOffice,
  PAName,
  BillingType,
  WIPHRS,
  WIPAMT,
  BHWIPHRS,
  BHWIPAMT,
  [To Date],
  [Run On],
  Year,
  Month,
  FinancialYear,
  Month_StartDate,
  Month_EndDate
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE Office = 'Delhi';


Instruction:
1) Guidelines
1) Objective: Return total WIP amount grouped by Client.
2) Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
3) Measures: Total WIPAMT → WIPAMT, SUM, monetary: yes, currency_column: null
4) Dimensions: Client
5) Temporal filter: Default last 2 years on financial-year basis (Apr–Mar). Use Month/Year:
   (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
6) Row filtering: None
7) Sorting and limit: None
8) Joins: None
9) Columns to SELECT: Client, SUM(WIPAMT)
10) Notes/assumptions: Amounts are INR; no explicit cut-off date provided, so Month/Year filter used instead of [To Date].

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "Total WIPAMT", "column": "WIPAMT", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["Client"],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 financial years; use Month/Year since no 'as of' cut-off specified."
}

SELECT
  Client,
  SUM(WIPAMT) AS TotalWIPAMT
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
GROUP BY Client;


Instruction:
1) Guidelines
- 1) Objective: Return WIP rows with WIPHRS greater than 20 within the default 2-year financial window.
- 2) Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- 3) Measures: WIPHRS → WIPHRS, agg = NONE, monetary = false; (no currency column)
- 4) Dimensions: None (return detailed rows)
- 5) Temporal filter: Default to last 2 financial years (Apr–Mar). Use Year/Month:
  - (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: WIPHRS > 20
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: Client, Matter, FileName, PAName, Team, Office, BillingType, WIPHRS, WIPAMT, Year, Month
- 10) Notes/assumptions: Chosen the general WIP table; no “till date” phrasing, so not using [To Date].

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "WIPHRS", "column": "WIPHRS", "agg": "NONE", "monetary": false, "currency_column": null }
  ],
  "dimensions": [],
  "filters": [
    "WIPHRS > 20",
    "(Year > 2023 OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Using general WIP table; default 2-year financial window applied."
}

SELECT
  Client,
  Matter,
  FileName,
  PAName,
  Team,
  Office,
  BillingType,
  WIPHRS,
  WIPAMT,
  Year,
  Month
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE WIPHRS > 20;


Instruction:
1) Guidelines
- 1) Objective: Return the total count of WIP entries.
- 2) Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- 3) Measures: WIPEntryCount → COUNT(*), aggregation COUNT, monetary? no, currency column: null
- 4) Dimensions: None (single overall total)
- 5) Temporal filter: Default to last 2 financial years (Apr–Mar). Use Year/Month mapping:
  WHERE (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: WIPEntryCount (COUNT(*))
- 10) Notes/assumptions: Applied default 2-year financial window ending in Nov 2025. If “all-time” is intended, remove the temporal filter.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "WIPEntryCount", "column": "*", "agg": "COUNT", "monetary": false, "currency_column": "null" }
  ],
  "dimensions": [],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Defaulted to last 2 financial years; remove time filter for all-time count."
}

SELECT COUNT(*) AS WIPEntryCount
FROM db_owner.NLP_IR_WIPExcelTracker_tbl;


Retrieve WIP for all matters grouped by tl

Instruction:
1) Guidelines
- 1) Objective: Return total WIP grouped by TL for all matters.
- 2) Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- 3) Measures: Total WIP → WIPAMT, aggregation SUM, monetary: yes, currency column: null (assumed INR)
- 4) Dimensions: TL
- 5) Temporal filter: Default to last 2 financial years (Apr–Mar). Use Month_StartDate between '2023-04-01' and '2025-11-20' (current date).
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: TL, SUM(WIPAMT)
- 10) Notes/assumptions: Default window applied; change dates if a different period is needed.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "Total WIP", "column": "WIPAMT", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["TL"],
  "filters": ["Month_StartDate BETWEEN '2023-04-01' AND '2025-11-20'"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Assuming INR and default last 2 financial years."
}

SELECT
  TL,
  SUM(WIPAMT) AS [Total WIP]
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
GROUP BY TL;


Retrieve WIP for all matters handled by TL 'Harsh Parikh'.

Instruction:
1) Guidelines
- Objective: Return WIP amounts for all matters handled by TL 'Harsh Parikh', grouped by matter (and client for clarity).
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures: WIP Amount → WIPAMT, aggregation SUM, monetary yes, currency column null (default INR)
- Dimensions: Client, Matter
- Temporal filter: Use default last two financial years (Apr–Mar). SQL-ready: ( (Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 3) )
- Row filtering: TL = 'Harsh Parikh'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Client, Matter, SUM(WIPAMT)
- Notes/assumptions: Matter names may repeat across clients; Client included to distinguish. If you intended an “as-of/till date” cut-off, switch to using [To Date] in WIP and filter accordingly.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "WIP Amount", "column": "WIPAMT", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["Client", "Matter"],
  "filters": ["TL = 'Harsh Parikh'", "((Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 3))"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-03-31", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Defaulted to last two financial years; include Client to disambiguate matter names."
}

SELECT
  Client,
  Matter,
  SUM(WIPAMT) AS [WIP Amount]
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE TL = 'Harsh Parikh'
GROUP BY Client, Matter;


Show WIP summary grouped by BillingType.

Instruction:
1) Guidelines
- Objective: Summarize WIP grouped by BillingType for the default window.
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures:
  - Total WIP Hours → WIPHRS, aggregation SUM, monetary? no
  - Total WIP Amount → WIPAMT, aggregation SUM, monetary? yes, currency_column null
- Dimensions: BillingType
- Temporal filter: Default last 2 years, financial basis. Use Year/Month since no “as of” wording.
  - SQL-ready: ((Year > 2023) OR (Year = 2023 AND Month >= 12)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillingType, SUM(WIPHRS) as TotalWIPHRS, SUM(WIPAMT) as TotalWIPAMT
- Notes/assumptions: If an “as of” cut-off was intended, use [To Date] instead of Year/Month; here we apply the default last 24 months.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "TotalWIPHRS", "column": "WIPHRS", "agg": "SUM", "monetary": false, "currency_column": null },
    { "label": "TotalWIPAMT", "column": "WIPAMT", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["BillingType"],
  "filters": [
    "((Year > 2023) OR (Year = 2023 AND Month >= 12)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-12-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Using default last 24 months via Year/Month; if cut-off is required, switch to [To Date] filter."
}

SELECT
  BillingType,
  SUM(WIPHRS) AS TotalWIPHRS,
  SUM(WIPAMT) AS TotalWIPAMT
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
GROUP BY BillingType;


Retrieve OS records sum with respect to payment status

Instruction:
1) Guidelines
- Objective: Sum outstanding amounts grouped by payment status.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: Total OS INR → [OS INR], aggregation SUM, monetary yes, currency column null (amount already in INR)
- Dimensions: [Payment Status]
- Temporal filter: Default to last 2 years on financial-year basis; use Month/Year columns. SQL-ready: (Year >= YEAR(GETDATE()) - 2)
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: [Payment Status], SUM([OS INR])
- Notes/assumptions: Using the default last-2-years window. If the intent is “as of/till date,” switch to filtering by [To Date] instead of Year/Month.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "Total OS INR", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["[Payment Status]"],
  "filters": ["(Year >= YEAR(GETDATE()) - 2)"],
  "time_window": { "basis": "financial", "start": null, "end": null, "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Defaulting to last 2 financial years; switch to [To Date] if a cut-off is requested."
}

SELECT
  [Payment Status],
  SUM([OS INR]) AS [Total OS INR]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
GROUP BY [Payment Status];


Retrieve OS records with payment status 'Part'.

Instruction:
1) Guidelines
- 1) Objective: List outstanding (OS) records where Payment Status is 'Part'.
- 2) Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- 3) Measures: OS Amount → [OS INR], aggregation NONE, monetary yes, currency column [Billing Currency]
- 4) Dimensions: [Client Name], [Bill No], [Bill Dt], [Payment Status], Location
- 5) Temporal filter: Default last 2 financial years. Use Year/Month mapping: from Apr 2023 to Nov 2025. SQL-ready filter: ((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: [Payment Status] = 'Part'
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: [Client Name], [Bill No], [Bill Dt], [OS INR], [Billing Currency], [Payment Status], Location
- 10) Notes/assumptions: Using default 2-year window (financial basis). No cut-off asked, so not filtering by [To Date].

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS Amount", "column": "[OS INR]", "agg": "NONE", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": ["[Client Name]", "[Bill No]", "[Bill Dt]", "[Payment Status]", "Location"],
  "filters": ["[Payment Status] = 'Part'", "((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 financial years applied; no [To Date] cut-off requested."
}

SELECT
  [Client Name],
  [Bill No],
  [Bill Dt],
  [OS INR],
  [Billing Currency],
  [Payment Status],
  Location
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE [Payment Status] = 'Part';


Instruction:
1) Guidelines
- Objective: Summarize total OS INR by Ageing Bucket.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: Total OS INR → [OS INR], SUM, monetary: yes, currency column: none (values already in INR)
- Dimensions: [Ageing Bucket]
- Temporal filter: Default last 2 years on financial basis; use Month_StartDate between DATEADD(year, -2, GETDATE()) and GETDATE()
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: [Ageing Bucket], SUM([OS INR])
- Notes/assumptions: OS INR is already in INR, so no separate currency column is included. Using Month_StartDate for the 2-year window since no specific cut-off was requested.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "Total OS INR", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["[Ageing Bucket]"],
  "filters": ["[Month_StartDate] BETWEEN DATEADD(year, -2, GETDATE()) AND GETDATE()"],
  "time_window": { "basis": "financial", "start": null, "end": null, "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Aggregated over the last 2 years using Month_StartDate; OS INR is in INR."
}

SELECT
  [Ageing Bucket],
  SUM([OS INR]) AS [Total OS INR]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
GROUP BY [Ageing Bucket];


Instruction:
1) Guidelines
- Objective: List outstanding (OS) entries with OS INR greater than 100000 within the default 2-year financial window.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: OS INR → [OS INR], aggregation NONE, monetary yes, currency column [Billing Currency]
- Dimensions: None (return entry-level rows)
- Temporal filter: Default financial window (Apr–Mar). Use Year/Month: (Year > 2023) OR (Year = 2023 AND Month >= 4) OR (Year = 2025 AND Month <= 11)
- Row filtering: [OS INR] > 100000
- Sorting and limit: None
- Joins: None
- Columns to SELECT: [Client Name], [Bill No], [Bill Dt], Location, PAName, Team, [Billing Currency], [OS INR]
- Notes/assumptions: No “as of/till date” phrasing; using default last 2 financial years (Apr 2023 to Nov 2025).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS INR", "column": "[OS INR]", "agg": "NONE", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": [],
  "filters": [
    "[OS INR] > 100000",
    "(Year > 2023) OR (Year = 2023 AND Month >= 4) OR (Year = 2025 AND Month <= 11)"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 financial years; no explicit cut-off date requested."
}

SELECT
  [Client Name],
  [Bill No],
  [Bill Dt],
  Location,
  PAName,
  Team,
  [OS INR]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE [OS INR] > 100000;


Show OS details for bill number 'MUM2526B09559'.

Instruction:
1) Guidelines
- Objective: Return outstanding (OS) details for the specific bill number MUM2526B09559.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: OS Amount INR → [OS INR], agg: NONE, monetary: yes, currency column: [Billing Currency]
- Dimensions: None (no grouping required; return row-level bill details)
- Temporal filter: None (bill-specific lookup; no cut-off requested)
- Row filtering: [Bill No] = 'MUM2526B09559'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: [Bill No], [Bill Dt], [Client Name], Location, Team, PAName, [Billing Currency], [OS INR], [Ageing Bucket], [Payment Status], [To Date]
- Notes/assumptions: If multiple records exist for the bill number, return all matching rows.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS Amount INR", "column": "[OS INR]", "agg": "NONE", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": [],
  "filters": ["[Bill No] = 'MUM2526B09559'"],
  "time_window": { "basis": "financial", "start": null, "end": null, "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Return bill-level OS details for the given bill number; no aggregation."
}

SELECT
  [Bill No],
  [Bill Dt],
  [Client Name],
  Location,
  Team,
  PAName,
  [Billing Currency],
  [OS INR],
  [Ageing Bucket],
  [Payment Status],
  [To Date]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE [Bill No] = 'MUM2526B09559';


Instruction:
1) Guidelines
- Objective: List OS records that are in foreign currency (non-INR).
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: OS Amount → [OS INR], aggregation NONE, monetary yes, currency column [Billing Currency]
- Dimensions: None (return detailed records without grouping)
- Temporal filter: Default last 2 financial years (Apr–Mar). Use Year/Month: (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: [Billing Currency] IS NOT NULL AND [Billing Currency] <> 'INR'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Location, [Client Name], [Bill No], [Bill Dt], [Billing Currency], [OS INR]
- Notes/assumptions: Using default 2-year window since no time was specified; not using [To Date] as no “as of” cut-off was requested.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS Amount", "column": "[OS INR]", "agg": "NONE", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": [],
  "filters": [
    "[Billing Currency] IS NOT NULL",
    "[Billing Currency] <> 'INR'",
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year financial window applied; listing foreign-currency OS records without aggregation."
}

SELECT
  Location,
  [Client Name],
  [Bill No],
  [Bill Dt],
  [Billing Currency],
  [OS INR]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE [Billing Currency] IS NOT NULL
  AND [Billing Currency] <> 'INR';


Show total outstanding per client group.

Instruction:
1) Guidelines
- Objective: Show total outstanding amounts per client group.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: Total Outstanding INR → [OS INR], aggregation SUM, monetary yes, currency column [Billing Currency]
- Dimensions: [Client Group]
- Temporal filter: Default to last 2 financial years (Apr–Mar). Use Month/Year. Predicate: (Year > 2023) OR (Year = 2023 AND Month >= 4)
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: [Client Group], SUM([OS INR])
- Notes/assumptions: Using financial-year basis with a 2-year default window. If an “as of/till date” cut-off was intended, prefer filtering by [To Date] instead of Month/Year.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "Total Outstanding INR", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": ["[Client Group]"],
  "filters": ["(Year > 2023) OR (Year = 2023 AND Month >= 4)"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year financial window; switch to [To Date] if a cut-off is requested."
}

SELECT
  [Client Group],
  SUM([OS INR]) AS TotalOutstandingINR
FROM db_owner.NLP_IR_OSExcelTracker_tbl
GROUP BY [Client Group];


Retrieve all raised invoices from location 'Mumbai'.

Instruction:
1) Guidelines
- Objective: List all raised invoices for location Mumbai within the default last two financial years.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures: None (no aggregation; not monetary)
- Dimensions: None (no grouping required)
- Temporal filter: Financial year basis. Include FY 2023–24 and FY 2024–25. SQL-ready:
  ((Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 3))
- Row filtering: Location = 'Mumbai'
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Location, BillNo, BillDate, ClientName, ClientGroup, Matter, PAName, Team, BillingStatus
- Notes/assumptions: Applied default window of last two financial years since no period was specified.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": [
    "Location = 'Mumbai'",
    "((Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 3))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-03-31", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Defaulted to last two financial years (FY 2023-24 and FY 2024-25)."

SELECT
  Location,
  BillNo,
  BillDate,
  ClientName,
  ClientGroup,
  Matter,
  PAName,
  Team,
  BillingStatus
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE Location = 'Mumbai';


Show total ClientTotalINR raised per ClientName.

Instruction:
1) Guidelines
- Objective: Total INR billed (raised) per ClientName.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures: Total Raised INR → ClientTotalINR, aggregation SUM, monetary: yes, currency column: null (amounts are already in INR)
- Dimensions: ClientName
- Temporal filter: Default last 2 years on financial-year basis (Apr–Mar). Use date columns for clarity: Month_StartDate >= '2023-04-01' AND Month_EndDate <= '2025-11-20'
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: ClientName, SUM(ClientTotalINR)
- Notes/assumptions: Assumed INR and default 2-year window from Apr 1, 2023 to today on financial basis.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Total Raised INR", "column": "ClientTotalINR", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["ClientName"],
  "filters": ["[Month_StartDate] >= '2023-04-01'", "[Month_EndDate] <= '2025-11-20'"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default to last 2 financial years; amounts are INR."
}

SELECT
  ClientName,
  SUM(ClientTotalINR) AS TotalRaisedINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
GROUP BY ClientName;


Instruction:
1) Guidelines
- Objective: List raised invoices with credit notes applied (CNINR > 0) within the default last 2 financial years.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures: CNINR → CNINR, aggregation NONE, monetary yes, currency column Curency
- Dimensions: BillNo, BillDate, ClientName, Matter, PAName, Location
- Temporal filter: Financial year basis; default window last 2 years → use Year/Month. Predicates:
  - (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: CNINR > 0
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillNo, BillDate, ClientName, Matter, PAName, Location, CNINR, Curency
- Notes/assumptions: Using default 2-year financial window (Apr–Mar), computed to Apr 2023 through Nov 2025 based on current date.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Credit Note INR", "column": "CNINR", "agg": "NONE", "monetary": true, "currency_column": "Curency" }
  ],
  "dimensions": ["BillNo", "BillDate", "ClientName", "Matter", "PAName", "Location"],
  "filters": ["CNINR > 0", "(Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year financial window applied; no aggregation requested."
}

SELECT
  BillNo,
  BillDate,
  ClientName,
  Matter,
  PAName,
  Location,
  CNINR,
  Curency
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE CNINR > 0;


Show invoice count per month for FY 2023-24.

Instruction:
1) Guidelines
- Objective: Return the number of invoices raised per month in FY 2023–24 (Apr 2023 to Mar 2024).
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures: Invoice Count → BillNo, COUNT, monetary? no, currency column: null
- Dimensions: Year, Month
- Temporal filter: Financial year Apr 2023–Mar 2024 mapped to (Year = 2023 AND Month >= 4) OR (Year = 2024 AND Month <= 3); use Month/Year in WHERE.
- Row filtering: None
- Sorting and limit: Sort by Year ASC, Month ASC
- Joins: None
- Columns to SELECT: Year, Month, Invoice Count
- Notes/assumptions: Using Raised table as the source of invoices (BillNo). Financial-year window applied via Year/Month.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Invoice Count", "column": "BillNo", "agg": "COUNT", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["Year", "Month"],
  "filters": [
    "(Year = 2023 AND Month >= 4) OR (Year = 2024 AND Month <= 3)"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2024-03-31", "use_to_date_for_os": false },
  "order_by": [
    { "expr": "Year", "dir": "ASC" },
    { "expr": "Month", "dir": "ASC" }
  ],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Invoice count sourced from Raised table using BillNo; FY 2023-24 mapped via Year/Month."
}

SELECT
  Year,
  Month,
  COUNT(BillNo) AS InvoiceCount
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE (Year = 2023 AND Month >= 4) OR (Year = 2024 AND Month <= 3)
GROUP BY Year, Month
ORDER BY Year ASC, Month ASC;


Retrieve all raised invoices in foreign currency.

Instruction:
1) Guidelines
- 1) Objective: Return all raised invoice records where the currency is foreign (not INR), limited to the default last 2 financial years.
- 2) Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- 3) Measures: None (no aggregation; user asked for records, not totals)
- 4) Dimensions: None (no grouping requested)
- 5) Temporal filter: Default to last 2 financial years (Apr–Mar). Use Year/Month mapping: (Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 11)
- 6) Row filtering: Curency IS NOT NULL AND Curency <> 'INR'
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: BillNo, BillDate, ClientName, Matter, Curency, Location, Team, PAName, ClientTotalINR
- 10) Notes/assumptions: “Foreign currency” interpreted as Curency not equal to 'INR'. Using financial-year basis for default window: Apr 1, 2023 to Nov 20, 2025.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": [
    "Curency IS NOT NULL",
    "Curency <> 'INR'",
    "(Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 11)"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Foreign currency determined by Curency <> 'INR'; default last 2 financial years applied."
}

SELECT
  BillNo,
  BillDate,
  ClientName,
  Matter,
  Curency,
  Location,
  Team,
  PAName,
  ClientTotalINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE Curency IS NOT NULL
  AND Curency <> 'INR';


Instruction:
1) Guidelines
- 1) Objective: Return total IC Total INR aggregated by TL.
- 2) Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- 3) Measures: IC Total INR → [IC Total INR], aggregation SUM, monetary yes, currency column not needed (amount already in INR)
- 4) Dimensions: TL
- 5) Temporal filter: Default last 2 financial years (Apr–Mar). Use Month/Year: ((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: TL, SUM([IC Total INR]) as TotalICTotalINR
- 10) Notes/assumptions: Amounts are in INR; window taken as Apr 2023 through Nov 2025.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Total IC Total INR", "column": "[IC Total INR]", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["TL"],
  "filters": [
    "((Year > 2023) OR (Year = 2023 AND Month >= 4))",
    "((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default to last 2 financial years; amounts are INR."
}

SELECT
  TL,
  SUM([IC Total INR]) AS TotalICTotalINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
GROUP BY TL;


Instruction:
1) Guidelines
- 1) Objective: Return the top 10 clients by billed amount (INR) over the default last two financial years.
- 2) Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- 3) Measures: Total Billed INR → ClientTotalINR, aggregation SUM, monetary yes, currency column null (amount is already in INR)
- 4) Dimensions: ClientName
- 5) Temporal filter: Default to last 2 financial years (Apr–Mar). Use Year/Month: ((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: None
- 7) Sorting and limit: Order by SUM(ClientTotalINR) DESC; return Top 10
- 8) Joins: None
- 9) Columns to SELECT: ClientName, SUM(ClientTotalINR)
- 10) Notes/assumptions: “Top” interpreted as highest billed amount (ClientTotalINR) in INR; window assumed to last two financial years.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Total Billed INR", "column": "ClientTotalINR", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["ClientName"],
  "filters": [
    "((Year > 2023) OR (Year = 2023 AND Month >= 4))",
    "((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [{ "expr": "SUM(ClientTotalINR)", "dir": "DESC" }],
  "top_n": 10,
  "joins": [],
  "include_srno": false,
  "notes": "Top clients determined by billed INR (ClientTotalINR) over the last two financial years."
}

SELECT TOP 10
  ClientName,
  SUM(ClientTotalINR) AS TotalBilledINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE ((Year > 2023) OR (Year = 2023 AND Month >= 4))
  AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
GROUP BY ClientName
ORDER BY SUM(ClientTotalINR) DESC;

SELECT TOP 10
  ClientName,
  SUM(ClientTotalINR) AS TotalBilledINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
GROUP BY ClientName
ORDER BY SUM(ClientTotalINR) DESC;


List all receipts for client 'Reliance Retail Limited'.

Instruction:
1) Guidelines
- Objective: List all receipt records for client 'Reliance Retail Limited' (no aggregation).
- Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- Measures: None (listing records only; no aggregation or totals requested).
- Dimensions: None (no grouping requested).
- Temporal filter: Default to last 2 financial years; use receipt date. SQL-ready: [Receipt Dt] >= '2023-04-01' AND [Receipt Dt] <= GETDATE()
- Row filtering: ClientName = 'Reliance Retail Limited' AND [Receipt Dt] IS NOT NULL
- Sorting and limit: None
- Joins: None
- Columns to SELECT: ClientName, BillNumber, BillDate, [Receipt Dt], ReceiptType, ReceiptCurr, ReceiptCurrAmt, CurrencyRate, TotalRealised, VchNo, ChequeNumber, ChequeDate, Location, PAName
- Notes/assumptions: No timeframe given; applied default “last 2 years” on financial-year basis via [Receipt Dt] from 2023-04-01 to today.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [],
  "dimensions": [],
  "filters": [
    "ClientName = 'Reliance Retail Limited'",
    "[Receipt Dt] IS NOT NULL",
    "[Receipt Dt] >= '2023-04-01'",
    "[Receipt Dt] <= GETDATE()"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "today", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Listing receipts for the client; defaulted to last 2 financial years using receipt date."
}

SELECT
  ClientName,
  BillNumber,
  BillDate,
  [Receipt Dt],
  ReceiptType,
  ReceiptCurr,
  ReceiptCurrAmt,
  CurrencyRate,
  TotalRealised,
  VchNo,
  ChequeNumber,
  ChequeDate,
  Location
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
WHERE ClientName = 'Reliance Retail Limited'
  AND [Receipt Dt] IS NOT NULL;


Show total realised amount per location.

Instruction:
1) Guidelines
- Objective: Return total realised amount per Location.
- Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- Measures: Total realised → TotalRealised, aggregation SUM, monetary yes, currency_column null (amount is already INR)
- Dimensions: Location
- Temporal filter: Default last 2 financial years (Apr–Mar). SQL-ready predicate: (Year > YEAR(GETDATE()) - 2 OR (Year = YEAR(GETDATE()) - 2 AND Month >= 4)) AND (Year < YEAR(GETDATE()) + 1 OR (Year = YEAR(GETDATE()) AND Month <= MONTH(GETDATE())))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Location, SUM(TotalRealised)
- Notes/assumptions: TotalRealised is in INR; using financial-year logic for the last 2 years.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "Total Realised INR", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["Location"],
  "filters": [
    "(Year > YEAR(GETDATE()) - 2 OR (Year = YEAR(GETDATE()) - 2 AND Month >= 4))",
    "(Year < YEAR(GETDATE()) + 1 OR (Year = YEAR(GETDATE()) AND Month <= MONTH(GETDATE())))"
  ],
  "time_window": { "basis": "financial", "start": "", "end": "", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default last 2 financial years (Apr–Mar); TotalRealised is INR."
}

SELECT
  Location,
  SUM(TotalRealised) AS [Total Realised INR]
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
GROUP BY Location;


List receipts done in the current month.

Instruction:
1) Guidelines
- 1) Objective: Return the list of receipt entries recorded in the current calendar month.
- 2) Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- 3) Measures: Total realised amount → TotalRealised, aggregation NONE, monetary yes, currency column ReceiptCurr
- 4) Dimensions: None (no grouping requested; return row-level receipts)
- 5) Temporal filter: Current month = Year = 2025 AND Month = 11; also ensure receipts have a date. SQL-ready: Year = 2025 AND Month = 11 AND [Receipt Dt] IS NOT NULL
- 6) Row filtering: None beyond the temporal and receipt-date predicate
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: [Receipt Dt], ClientName, Matter, BillNumber, TotalRealised, ReceiptCurr
- 10) Notes/assumptions: “Current month” interpreted as the calendar month of the system date (Nov 2025).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "Total Realised", "column": "TotalRealised", "agg": "NONE", "monetary": true, "currency_column": "ReceiptCurr" }
  ],
  "dimensions": [],
  "filters": ["Year = 2025", "Month = 11", "[Receipt Dt] IS NOT NULL"],
  "time_window": { "basis": "calendar", "start": "2025-11-01", "end": "2025-11-30", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Current month interpreted as November 2025."
}

SELECT
  [Receipt Dt],
  ClientName,
  Matter,
  BillNumber,
  TotalRealised,
  ReceiptCurr
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
WHERE Year = 2025
  AND Month = 11
  AND [Receipt Dt] IS NOT NULL;


Instruction:
1) Guidelines
- 1) Objective: Summarize billed vs realised amounts per client over the default last 2 financial years.
- 2) Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- 3) Measures:
  - Billed → TotalBilledINR, aggregation SUM, monetary yes, currency column null (amounts already in INR)
  - Realised → TotalRealised, aggregation SUM, monetary yes, currency column null (amounts already in INR)
- 4) Dimensions: ClientName
- 5) Temporal filter: Default to last 2 years on financial-year basis (Apr–Mar). Use Year/Month mapping:
  - (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: ClientName, SUM(TotalBilledINR) as BilledINR, SUM(TotalRealised) as RealisedINR
- 10) Notes/assumptions: Totals are in INR; using Realization table which contains both billed and realised metrics. Window assumed as Apr 2023 to Nov 2025 (financial year basis).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "BilledINR", "column": "TotalBilledINR", "agg": "SUM", "monetary": true, "currency_column": null },
    { "label": "RealisedINR", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["ClientName"],
  "filters": ["(Year > 2023 OR (Year = 2023 AND Month >= 4))", "(Year < 2025 OR (Year = 2025 AND Month <= 11))"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Billed vs realised per client using INR totals; default window = last 2 financial years (Apr 2023 to Nov 2025)."
}

SELECT
  ClientName,
  SUM(TotalBilledINR) AS BilledINR,
  SUM(TotalRealised) AS RealisedINR
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
GROUP BY ClientName


Show billed vs realised per client along with realization percentage

Instruction:
1) Guidelines
- Objective: Summarize billed vs realized per client and include realization percentage.
- Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- Measures:
  - Billed INR → TotalBilledINR, aggregation SUM, monetary yes, currency column null (values already in INR)
  - Realised INR → TotalRealised, aggregation SUM, monetary yes, currency column null (values already in INR)
  - Realization % → calculated as (SUM(TotalRealised) / NULLIF(SUM(TotalBilledINR), 0)) * 100
- Dimensions: ClientName
- Temporal filter: Default last 2 financial years (Apr–Mar). Use Year/Month:
  - (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: ClientName, SUM(TotalBilledINR) as BilledINR, SUM(TotalRealised) as RealisedINR, RealizationPct
- Notes/assumptions: Using Realization table which already contains billed and realized INR amounts; percentage computed from aggregated values.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "BilledINR", "column": "TotalBilledINR", "agg": "SUM", "monetary": true, "currency_column": null },
    { "label": "RealisedINR", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["ClientName"],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-30", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Compute RealizationPct as (SUM(TotalRealised) / NULLIF(SUM(TotalBilledINR), 0)) * 100 and include in SELECT."
}

SELECT
  ClientName,
  SUM(TotalBilledINR) AS BilledINR,
  SUM(TotalRealised) AS RealisedINR,
  (SUM(TotalRealised) / NULLIF(SUM(TotalBilledINR), 0)) * 100 AS RealizationPct
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
GROUP BY ClientName;


Show bills where realisation < 80% of billed.

Instruction:
1) Guidelines
- Objective: List bill-level records where realised amount is less than 80% of billed.
- Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- Measures:
  - Billed → TotalBilledINR, agg: NONE, monetary: yes, currency column: null
  - Realised → TotalRealised, agg: NONE, monetary: yes, currency column: null
- Dimensions: BillNumber, ClientName, Matter, BillDate, Location
- Temporal filter: Default last 2 years on financial-year basis (Apr–Mar).
  - Use Year/Month: (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: TotalRealised < 0.8 * TotalBilledINR AND TotalBilledINR > 0
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillNumber, ClientName, Matter, BillDate, Location, TotalBilledINR, TotalRealised
- Notes/assumptions: Applying default 2-year window; amounts are stored in INR in the table.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "Billed INR", "column": "TotalBilledINR", "agg": "NONE", "monetary": true, "currency_column": null },
    { "label": "Realised INR", "column": "TotalRealised", "agg": "NONE", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["BillNumber", "ClientName", "Matter", "BillDate", "Location"],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))",
    "TotalRealised < 0.8 * TotalBilledINR",
    "TotalBilledINR > 0"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year window applied; INR measures."
}

SELECT
  BillNumber,
  ClientName,
  Matter,
  BillDate,
  Location,
  TotalBilledINR,
  TotalRealised
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
WHERE TotalBilledINR > 0
  AND TotalRealised < 0.8 * TotalBilledINR;


Show top 5 bills with highest realization.

Instruction:
1) Guidelines
- Objective: Return the top 5 bills with the highest total realization amounts.
- Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- Measures: Total Realised → TotalRealised, aggregation = SUM, monetary = yes, currency column = null (assumed INR)
- Dimensions: BillNumber
- Temporal filter: Default window (financial year basis, last 2 years). Use Year/Month mapping: ((Year > 2023) OR (Year = 2023 AND Month >= 4)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: Order by SUM(TotalRealised) DESC; limit to top 5
- Joins: None
- Columns to SELECT: BillNumber, SUM(TotalRealised) as TotalRealised
- Notes/assumptions: TotalRealised treated as INR; aggregation used because multiple realization rows may exist per bill.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "TotalRealised", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["BillNumber"],
  "filters": [
    "((Year > 2023) OR (Year = 2023 AND Month >= 4))",
    "((Year < 2025) OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [{ "expr": "SUM(TotalRealised)", "dir": "DESC" }],
  "top_n": 5,
  "joins": [],
  "include_srno": false,
  "notes": "Assuming TotalRealised is in INR; grouping by BillNumber to aggregate multiple realization entries per bill."
}

SELECT TOP 5
  BillNumber,
  SUM(TotalRealised) AS TotalRealised
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
GROUP BY BillNumber
ORDER BY SUM(TotalRealised) DESC;


Instruction:
1) Guidelines
- Objective: Compare billed vs realised amounts per bill for the recent period.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures:
  - Billed INR → ClientTotalINR, aggregation SUM, monetary yes, currency column null
  - Realised INR → TotalRealised (from Realization table), aggregation SUM, monetary yes, currency column null
- Dimensions: BillNo, BillDate, ClientName
- Temporal filter: Default financial-year window, last ~2 years → use Year/Month on both tables
  - SQL-ready:
    - For Raised: (Year > 2023 OR (Year = 2023 AND Month >= 4))
    - For Realization: (Year > 2023 OR (Year = 2023 AND Month >= 4))
- Row filtering: None
- Sorting and limit: None
- Joins: Essential — join Realization to Raised on BillNo = BillNumber AND ClientName = ClientName
- Columns to SELECT: BillNo, BillDate, ClientName, SUM(ClientTotalINR) as BilledINR, SUM(TotalRealised) as RealisedINR
- Notes/assumptions: Use LEFT JOIN to retain bills with no realisation; default currency assumed INR.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Billed INR", "column": "ClientTotalINR", "agg": "SUM", "monetary": true, "currency_column": null },
    { "label": "Realised INR", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["BillNo", "BillDate", "ClientName"],
  "filters": [
    "(t1.Year > 2023 OR (t1.Year = 2023 AND t1.Month >= 4))",
    "(t2.Year > 2023 OR (t2.Year = 2023 AND t2.Month >= 4))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-30", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [
    { "table": "db_owner.NLP_IR_RealizationExcelTracker_tbl", "on": ["t1.BillNo = t2.BillNumber", "t1.ClientName = t2.ClientName"] }
  ],
  "include_srno": false,
  "notes": "Use LEFT JOIN from Raised to Realization to include bills with zero realisation; default currency INR."
}

SELECT
  t1.BillNo,
  t1.BillDate,
  t1.ClientName,
  SUM(t1.ClientTotalINR) AS BilledINR,
  SUM(ISNULL(t2.TotalRealised, 0)) AS RealisedINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl AS t1
LEFT JOIN db_owner.NLP_IR_RealizationExcelTracker_tbl AS t2
  ON t1.BillNo = t2.BillNumber
  AND t1.ClientName = t2.ClientName
GROUP BY
  t1.BillNo,
  t1.BillDate,
  t1.ClientName;


Show matters present in both WIP and OS tables.

Instruction:
1) Guidelines
- Objective: List the matters that exist in both WIP and OS datasets.
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures: None (no aggregation; not monetary)
- Dimensions: Matter (db_owner.NLP_IR_WIPExcelTracker_tbl.Matter)
- Temporal filter: Default to last 2 financial years (Apr–Mar). Use Year/Month on both tables:
  - (db_owner.NLP_IR_WIPExcelTracker_tbl.Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (db_owner.NLP_IR_WIPExcelTracker_tbl.Year < 2025 OR (Year = 2025 AND Month <= 11))
  - (db_owner.NLP_IR_OSExcelTracker_tbl.Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (db_owner.NLP_IR_OSExcelTracker_tbl.Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: Required. Join db_owner.NLP_IR_WIPExcelTracker_tbl to db_owner.NLP_IR_OSExcelTracker_tbl on WIP.Matter = OS.[Matter Name]
- Columns to SELECT: db_owner.NLP_IR_WIPExcelTracker_tbl.Matter
- Notes/assumptions: Exact text match between Matter and [Matter Name]; if naming varies, intersection may be partial.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [],
  "dimensions": ["Matter"],
  "filters": [
    "(db_owner.NLP_IR_WIPExcelTracker_tbl.Year > 2023 OR (db_owner.NLP_IR_WIPExcelTracker_tbl.Year = 2023 AND db_owner.NLP_IR_WIPExcelTracker_tbl.Month >= 4))",
    "(db_owner.NLP_IR_WIPExcelTracker_tbl.Year < 2025 OR (db_owner.NLP_IR_WIPExcelTracker_tbl.Year = 2025 AND db_owner.NLP_IR_WIPExcelTracker_tbl.Month <= 11))",
    "(db_owner.NLP_IR_OSExcelTracker_tbl.Year > 2023 OR (db_owner.NLP_IR_OSExcelTracker_tbl.Year = 2023 AND db_owner.NLP_IR_OSExcelTracker_tbl.Month >= 4))",
    "(db_owner.NLP_IR_OSExcelTracker_tbl.Year < 2025 OR (db_owner.NLP_IR_OSExcelTracker_tbl.Year = 2025 AND db_owner.NLP_IR_OSExcelTracker_tbl.Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-30", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [
    { "table": "db_owner.NLP_IR_OSExcelTracker_tbl", "on": ["db_owner.NLP_IR_WIPExcelTracker_tbl.Matter = db_owner.NLP_IR_OSExcelTracker_tbl.[Matter Name]"] }
  ],
  "include_srno": false,
  "notes": "Defaulted to last 2 financial years; intersection based on exact text match of Matter names."
}

SELECT DISTINCT w.Matter
FROM db_owner.NLP_IR_WIPExcelTracker_tbl AS w
INNER JOIN db_owner.NLP_IR_OSExcelTracker_tbl AS o
  ON w.Matter = o.[Matter Name];


Instruction:
1) Guidelines
- Objective: Return the top 5 credit note records by amount.
- Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- Measures: CreditNoteAmount → ClientTotalINR, aggregation NONE, monetary yes, currency column Curency
- Dimensions: None (return individual records)
- Temporal filter: Default last 2 financial years; use BillDate between '2023-04-01' and '2025-11-20'
- Row filtering: None
- Sorting and limit: Sort by ClientTotalINR DESC; limit to TOP 5
- Joins: None
- Columns to SELECT: BillNumber, BillDate, ClientName, PAName, Location, ClientTotalINR, Curency
- Notes/assumptions: Interpreted “top 5” as highest ClientTotalINR amounts; adjust if a different CN measure is required.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [
    { "label": "CreditNoteAmount", "column": "ClientTotalINR", "agg": "NONE", "monetary": true, "currency_column": "Curency" }
  ],
  "dimensions": [],
  "filters": ["BillDate >= '2023-04-01'", "BillDate <= '2025-11-20'"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [{ "expr": "ClientTotalINR", "dir": "DESC" }],
  "top_n": 5,
  "joins": [],
  "include_srno": false,
  "notes": "Top 5 by ClientTotalINR within last two financial years."
}

SELECT TOP 5
  BillNumber,
  BillDate,
  ClientName,
  PAName,
  Location,
  ClientTotalINR,
  Curency
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE BillDate >= '2023-04-01'
  AND BillDate <= '2025-11-20'
ORDER BY ClientTotalINR DESC;

SELECT TOP 5
  BillNumber,
  BillDate,
  ClientName,
  PAName,
  Location,
  ClientTotalINR,
  Curency
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
ORDER BY ClientTotalINR DESC;


Retrieve credit notes count with respect to Reason

Instruction:
1) Guidelines
- Objective: Return the count of credit notes grouped by reason.
- Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- Measures: CreditNoteCount → COUNT(*), aggregation: COUNT, monetary: no, currency column: null
- Dimensions: CNReason
- Temporal filter: Default to last 2 years on financial year basis (Apr–Mar). Use Year/Month mapping: (Year > 2023) OR (Year = 2023 AND Month >= 4)
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: CNReason, CreditNoteCount
- Notes/assumptions: Using default 2-year financial window (from Apr 2023 onwards). Adjust if a different period is desired.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [
    { "label": "CreditNoteCount", "column": "*", "agg": "COUNT", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["CNReason"],
  "filters": ["(Year > 2023) OR (Year = 2023 AND Month >= 4)"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default financial-year window applied (last 2 years)."
}

SELECT
  CNReason,
  COUNT(*) AS CreditNoteCount
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
GROUP BY CNReason


Show WIP details updated in last 7 days.

Instruction:
1) Guidelines
- 1) Objective: Return WIP detail rows updated in the last 7 days.
- 2) Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- 3) Measures:
  - WIP Amount → WIPAMT, aggregation NONE, monetary yes, currency column null
  - WIP Hours → WIPHRS, aggregation NONE, monetary no
- 4) Dimensions: Office, Client, Matter, FileName, PAName
- 5) Temporal filter: Use [Run On] for “updated in last 7 days”. SQL-ready: [Run On] BETWEEN DATEADD(DAY, -7, GETDATE()) AND GETDATE()
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: Office, Client, Matter, FileName, PAName, WIPHRS, WIPAMT, [Run On]
- 10) Notes/assumptions: Using [Run On] as the update timestamp; default currency assumed INR for WIPAMT.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "WIP Amount", "column": "WIPAMT", "agg": "NONE", "monetary": true, "currency_column": null },
    { "label": "WIP Hours", "column": "WIPHRS", "agg": "NONE", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["Office", "Client", "Matter", "FileName", "PAName"],
  "filters": ["[Run On] BETWEEN DATEADD(DAY, -7, GETDATE()) AND GETDATE()"],
  "time_window": { "basis": "financial", "start": null, "end": null, "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Using [Run On] to capture updates in the last 7 days; WIPAMT assumed INR."
}

SELECT
  Office,
  Client,
  Matter,
  FileName,
  PAName,
  WIPHRS,
  WIPAMT,
  [Run On]
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
WHERE [Run On] BETWEEN DATEADD(DAY, -7, GETDATE()) AND GETDATE();


Instruction:
1) Guidelines
- Objective: List outstanding (OS) records where the age exceeds 90 days.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: OS Amount → [OS INR], aggregation NONE, monetary yes, currency column [Billing Currency]
- Dimensions: None (no grouping requested)
- Temporal filter: Use [To Date] as the ageing cut-off; apply predicate DATEDIFF(day, [Bill Dt], [To Date]) > 90
- Row filtering: None beyond the ageing predicate
- Sorting and limit: None
- Joins: None
- Columns to SELECT: [Client Name], [Bill No], [Bill Dt], [OS INR], [Billing Currency], [Ageing Bucket], [To Date]
- Notes/assumptions: No explicit date range applied; ageing computed using [To Date] snapshot versus [Bill Dt].

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS Amount", "column": "[OS INR]", "agg": "NONE", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": [],
  "filters": ["DATEDIFF(day, [Bill Dt], [To Date]) > 90"],
  "time_window": { "basis": "financial", "start": null, "end": null, "use_to_date_for_os": true },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Ageing computed as difference between [To Date] and [Bill Dt] exceeding 90 days."
}

SELECT
  [Client Name],
  [Bill No],
  [Bill Dt],
  [OS INR],
  [Billing Currency],
  [Ageing Bucket],
  [To Date]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
WHERE DATEDIFF(day, [Bill Dt], [To Date]) > 90;


Show raised invoices between two dates '2024-01-01' AND '2024-01-31'.

Instruction:
1) Guidelines
- Objective: List raised invoices within the date range 2024-01-01 to 2024-01-31.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures: Client Total (INR) → ClientTotalINR, aggregation NONE, monetary yes, currency column Curency
- Dimensions: BillNo, BillDate, ClientName, PAName, Location
- Temporal filter: Use BillDate BETWEEN '2024-01-01' AND '2024-01-31' (inclusive)
- Row filtering: None
- Sorting and limit: Order by BillDate ASC
- Joins: None
- Columns to SELECT: BillNo, BillDate, ClientName, PAName, Location, ClientTotalINR, Curency
- Notes/assumptions: Using BillDate as the raised date field.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "Client Total (INR)", "column": "ClientTotalINR", "agg": "NONE", "monetary": true, "currency_column": "Curency" }
  ],
  "dimensions": ["BillNo", "BillDate", "ClientName", "PAName", "Location"],
  "filters": ["BillDate >= '2024-01-01'", "BillDate <= '2024-01-31'"],
  "time_window": { "basis": "financial", "start": "2024-01-01", "end": "2024-01-31", "use_to_date_for_os": false },
  "order_by": [{ "expr": "BillDate", "dir": "ASC" }],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Using BillDate to identify raised invoices in the specified date range."
}

SELECT
  BillNo,
  BillDate,
  ClientName,
  PAName,
  Location,
  ClientTotalINR,
  Curency
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE BillDate BETWEEN '2024-01-01' AND '2024-01-31'
ORDER BY BillDate ASC;

SELECT BillNo, BillDate, ClientName, PAName, Location, ClientTotalINR, Curency
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
WHERE BillDate >= '2024-01-01' AND BillDate < '2024-02-01'
ORDER BY BillDate ASC;


Instruction:
1) Guidelines
- Objective: Return total WIP hours grouped by Team for the default window (last 2 financial years).
- Primary table: db_owner.NLP_IR_WIPExcelTracker_tbl
- Measures: Total WIP Hours → WIPHRS, aggregation = SUM, monetary? no, currency column = null
- Dimensions: Team
- Temporal filter: Financial year basis. Use Year/Month for last 2 years: (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: Team, SUM(WIPHRS)
- Notes/assumptions: Defaulted to financial-year window from 2023-04-01 to current month. No “as of/till date” wording, so [To Date] not used.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_WIPExcelTracker_tbl",
  "measures": [
    { "label": "Total WIP Hours", "column": "WIPHRS", "agg": "SUM", "monetary": false, "currency_column": null }
  ],
  "dimensions": ["Team"],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Using WIP table; last two financial years by Year/Month."
}

SELECT
  Team,
  SUM(WIPHRS) AS [Total WIP Hours]
FROM db_owner.NLP_IR_WIPExcelTracker_tbl
GROUP BY Team;


Instruction:
1) Guidelines
- Objective: Summarize outstanding (OS) amounts by RM for the default recent period.
- Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- Measures: Total OS → [OS INR], aggregation SUM, monetary yes, currency column not required (default INR)
- Dimensions: RM
- Temporal filter: Default last 24 months using Year/Month. Use: (([Year] > 2023) OR ([Year] = 2023 AND [Month] >= 11)) AND (([Year] < 2025) OR ([Year] = 2025 AND [Month] <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: RM, SUM([OS INR])
- Notes/assumptions: Default window applied as last 24 months; if an “as of/till date” cut-off is needed, use [To Date] instead of Year/Month.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "Total OS INR", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["RM"],
  "filters": [
    "(([Year] > 2023) OR ([Year] = 2023 AND [Month] >= 11))",
    "(([Year] < 2025) OR ([Year] = 2025 AND [Month] <= 11))"
  ],
  "time_window": { "basis": "financial", "start": "2023-11-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Summarized by RM over the last 24 months; amounts in INR."
}

SELECT
  RM,
  SUM([OS INR]) AS [Total OS INR]
FROM db_owner.NLP_IR_OSExcelTracker_tbl
GROUP BY RM;


Instruction:
1) Guidelines
- Objective: Return the top 10 clients by billed amount.
- Primary table: db_owner.NLP_IR_RaisedExcelTracker_tbl
- Measures: Total Billed → ClientTotalINR, aggregation SUM, monetary yes, currency column null (amounts already in INR)
- Dimensions: ClientName
- Temporal filter: Default to last 2 financial years (Apr–Mar). Use Year/Month: (Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 3)
- Row filtering: None
- Sorting and limit: Order by SUM(ClientTotalINR) DESC; limit to TOP 10
- Joins: None
- Columns to SELECT: ClientName, SUM(ClientTotalINR) as TotalBilledINR
- Notes/assumptions: Interpreted “highest billed” as total billed in INR over the last two financial years (FY 2023–24 and FY 2024–25).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RaisedExcelTracker_tbl",
  "measures": [
    { "label": "TotalBilledINR", "column": "ClientTotalINR", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["ClientName"],
  "filters": ["(Year = 2023 AND Month >= 4) OR (Year = 2024) OR (Year = 2025 AND Month <= 3)"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-03-31", "use_to_date_for_os": false },
  "order_by": [{ "expr": "TotalBilledINR", "dir": "DESC" }],
  "top_n": 10,
  "joins": [],
  "include_srno": false,
  "notes": "Top 10 clients by total billed INR over FY 2023–24 and FY 2024–25."
}

SELECT TOP 10
  ClientName,
  SUM(ClientTotalINR) AS TotalBilledINR
FROM db_owner.NLP_IR_RaisedExcelTracker_tbl
GROUP BY ClientName
ORDER BY SUM(ClientTotalINR) DESC;


Instruction:
1) Guidelines
- Objective: Summarize realization amounts grouped by bill type.
- Primary table: db_owner.NLP_IR_RealizationExcelTracker_tbl
- Measures: Total Realised → TotalRealised, aggregation SUM, monetary yes, currency_column null
- Dimensions: BillType
- Temporal filter: Default last 2 years on financial basis; use Year/Month predicates: ((Year > 2023) OR (Year = 2023 AND Month >= 11)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))
- Row filtering: None
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillType, SUM(TotalRealised)
- Notes/assumptions: Assumes a rolling 24-month window ending current month (financial basis).

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_RealizationExcelTracker_tbl",
  "measures": [
    { "label": "Total Realised", "column": "TotalRealised", "agg": "SUM", "monetary": true, "currency_column": null }
  ],
  "dimensions": ["BillType"],
  "filters": ["((Year > 2023) OR (Year = 2023 AND Month >= 11)) AND ((Year < 2025) OR (Year = 2025 AND Month <= 11))"],
  "time_window": { "basis": "financial", "start": "2023-11-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Rolling last 24 months ending Nov 2025; grouped by BillType."
}

SELECT
  BillType,
  SUM(TotalRealised) AS TotalRealised
FROM db_owner.NLP_IR_RealizationExcelTracker_tbl
GROUP BY BillType;


Show credit notes with amount greater than average.

Instruction:
1) Guidelines
- Objective: List credit note records where the credit note amount is greater than the overall average amount for the default window.
- Primary table: db_owner.NLP_IR_CreditNoteExcelTracker_tbl
- Measures: Amount → ClientTotalINR, aggregation NONE, monetary yes, currency column Curency
- Dimensions: None (return row-level credit notes)
- Temporal filter: Default last 2 financial years. SQL-ready: (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11))
- Row filtering: ClientTotalINR > (average ClientTotalINR over the same temporal window). Use a subquery: ClientTotalINR > (SELECT AVG(ClientTotalINR) FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl WHERE (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11)))
- Sorting and limit: None
- Joins: None
- Columns to SELECT: BillNumber, BillDate, ClientName, PAName, CNReason, ClientTotalINR, Curency
- Notes/assumptions: Using ClientTotalINR as the credit note amount; change if a different amount column is desired.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_CreditNoteExcelTracker_tbl",
  "measures": [
    { "label": "Credit Note Amount", "column": "ClientTotalINR", "agg": "NONE", "monetary": true, "currency_column": "Curency" }
  ],
  "dimensions": [],
  "filters": [
    "(Year > 2023 OR (Year = 2023 AND Month >= 4))",
    "(Year < 2025 OR (Year = 2025 AND Month <= 11))",
    "ClientTotalINR > (SELECT AVG(ClientTotalINR) FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl WHERE (Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11)))"
  ],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Assumed ClientTotalINR represents the credit note amount; default window = last 2 financial years."
}

SELECT
  BillNumber,
  BillDate,
  ClientName,
  PAName,
  CNReason,
  ClientTotalINR,
  Curency
FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
WHERE ClientTotalINR > (
  SELECT AVG(ClientTotalINR)
  FROM db_owner.NLP_IR_CreditNoteExcelTracker_tbl
);


Retrieve OS entries grouped by TeamOffice.

Instruction:
1) Guidelines
- 1) Objective: Summarize outstanding (OS) amounts grouped by TeamOffice.
- 2) Primary table: db_owner.NLP_IR_OSExcelTracker_tbl
- 3) Measures: OS INR → [OS INR], aggregation SUM, monetary yes, currency column [Billing Currency]
- 4) Dimensions: TeamOffice
- 5) Temporal filter: Default to last 2 years on a financial-year basis. Use Year/Month since no “as of/till date” cut-off was specified. SQL-ready: ((Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11)))
- 6) Row filtering: None
- 7) Sorting and limit: None
- 8) Joins: None
- 9) Columns to SELECT: TeamOffice, SUM([OS INR]) as OS_INR, [Billing Currency]
- 10) Notes/assumptions: Values are in INR; using Apr 2023 through Nov 2025 as the default window.

2) Instruction JSON
{
  "primary_table": "db_owner.NLP_IR_OSExcelTracker_tbl",
  "measures": [
    { "label": "OS INR", "column": "[OS INR]", "agg": "SUM", "monetary": true, "currency_column": "[Billing Currency]" }
  ],
  "dimensions": ["TeamOffice"],
  "filters": ["((Year > 2023 OR (Year = 2023 AND Month >= 4)) AND (Year < 2025 OR (Year = 2025 AND Month <= 11)))"],
  "time_window": { "basis": "financial", "start": "2023-04-01", "end": "2025-11-20", "use_to_date_for_os": false },
  "order_by": [],
  "top_n": null,
  "joins": [],
  "include_srno": false,
  "notes": "Default 2-year financial window applied; grouping by TeamOffice; OS amounts in INR."
}

SELECT
  TeamOffice,
  SUM([OS INR]) AS OS_INR
FROM db_owner.NLP_IR_OSExcelTracker_tbl
GROUP BY TeamOffice;