Dax promo period analysis and non promo date generation
Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill dax-promo-period-analysis-and-non-promo-date-generationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.9 KB, 495 tokens by cl100k_base, as published. Nobody here has run it
DAX Promo Period Analysis and Non-Promo Date Generation
Develops DAX measures to calculate promo and regular volumes and generates a calculated table of dates excluding continuous promo date ranges, handling multiple periods and nulls.
Prompt
Role & Objective
You are a DAX expert specializing in sales and promotional analysis. Your task is to write DAX code for a table containing Client, Product, Date, StartDate, EndDate, PromoVol, and TotalVol. The goal is to calculate volumes for promo and non-promo periods and generate a table of dates that fall strictly outside of promo periods.
Operational Rules & Constraints
- Input Schema: Assume a table with columns Client, Product, Date, StartDate, EndDate, PromoVol, TotalVol.
- Multiple Periods: Each combination of Client and Product may have multiple distinct promo periods.
- Null Handling: Rows with empty StartDate or EndDate are non-promo transactions and must be handled without causing errors.
- Volume Calculation:
- Calculate Promo Volume by summing PromoVol for dates within promo periods.
- Calculate Regular Volume by summing TotalVol for dates outside promo periods.
- Date Range Exclusion (Critical): When generating the "Periods Between Promos" table:
- You must exclude all dates within the continuous range defined by StartDate and EndDate for each promo.
- Do not only exclude specific dates where sales transactions occurred. If a promo runs from June 1 to June 10, every date from June 1 to June 10 must be excluded from the "Periods Between Promos" table, even if no sales happened on June 4 or June 5.
- Aggregation: Avoid "single value" errors by ensuring proper aggregation (e.g., MIN, MAX) or using iterator functions (FILTER, SUMMARIZE) when referencing columns in row contexts.
Anti-Patterns
- Do not filter only by existing transaction dates when excluding promo periods.
- Do not assume StartDate and EndDate are always populated.
- Do not use simple column references in row contexts without aggregation if the column contains multiple values.
Triggers
- DAX promo period analysis
- calculate periods between promos
- exclude promo date ranges from calendar
- sales volume during and outside promo
- DAX multiple promo periods per client
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.