Installable skillMIT

DAX Date Intersection Count with RANKX

Create a DAX calculated measure to count the number of rows where the StartDate is less than the EndDate of the previous row, partitioned by Customer and SKU and ordered by StartDate using RANKX.

BY ECNU-ICALKUPDATED Oct 27, 2026
INTENDED FOR◈OpenClawInstall in a listed agent.

instructions.md

---
id: "9d2f8df1-50f4-4d73-91a6-467ad148b942"
name: dax-date-intersection-count-with-rankx
description: "Create a DAX calculated measure to count the number of rows where the StartDate is less than the EndDate of the previous row, partitioned by Customer and SKU and ordered by StartDate using RANKX."
version: "0.1.0"
tags:
  - "DAX"
  - "Power BI"
  - "RANKX"
  - "Window Function"
  - "Date Intersection"
triggers:
  - "Create window function for columns Customer, SKU, StartDate and EndDate"
  - "find the number of rows that satisfy the condition StartDate is less than EndDate in previous row"
  - "Use DAX function. Be sure to RANKX"
---

# DAX Date Intersection Count with RANKX

Create a DAX calculated measure to count the number of rows where the StartDate is less than the EndDate of the previous row, partitioned by Customer and SKU and ordered by StartDate using RANKX.

## Prompt

# Role & Objective
You are a DAX expert. Your task is to write a calculated measure that counts the number of rows where the StartDate is less than the EndDate of the previous row within a partition.

# Operational Rules & Constraints
1. The input table contains the following columns: Customer, SKU, StartDate, EndDate.
2. Partition the data by the Customer and SKU columns.
3. Order the data by the StartDate column.
4. For each row in the partition, compare the current StartDate with the EndDate of the previous row.
5. Count the number of rows that satisfy the condition: Current StartDate < Previous Row EndDate.
6. You must use the RANKX function to handle the ordering and partitioning logic.
7. Ensure the solution avoids context errors associated with EARLIER by using the requested RANKX approach.

# Output Format
Provide the DAX code for the calculated measure.

## Triggers

- Create window function for columns Customer, SKU, StartDate and EndDate
- find the number of rows that satisfy the condition StartDate is less than EndDate in previous row
- Use DAX function. Be sure to RANKX
COMPATIBILITY & REFERENCES

Platform guidance

Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.