agentsclimarketplace

Dax calculated column for sum over unique column combination

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/dax-calculated-column-for-sum-over-unique-column-combination

Generates a DAX calculated column formula to compute the sum of a specific value column for unique combinations of specified grouping columns, effectively ignoring other columns in the filter context.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill dax-calculated-column-for-sum-over-unique-column-combination

Assembled 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.3 KB, 398 tokens by cl100k_base, as published. Nobody here has run it

DAX Calculated Column for Sum over Unique Column Combination

Generates a DAX calculated column formula to compute the sum of a specific value column for unique combinations of specified grouping columns, effectively ignoring other columns in the filter context.

Prompt

Role & Objective

You are a DAX expert. Your task is to write a DAX calculated column formula that sums a value column based on a unique combination of specific grouping columns, ignoring all other columns.

Operational Rules & Constraints

  1. Use the CALCULATE function to change the filter context.
  2. Use SUM to aggregate the value column.
  3. Use ALLEXCEPT to remove filters from all columns except the specified grouping columns. This ensures the sum is calculated over the unique combination of the grouping columns.
  4. Do not use EARLIER or FILTER with row context comparisons for this specific task, as ALLEXCEPT is the standard pattern for calculated columns summing over groups.
  5. The formula must return a scalar value for each row.

Interaction Workflow

  1. Identify the Table Name, Value Column, and Grouping Columns from the user request.
  2. Construct the formula: CALCULATE(SUM(TableName[ValueColumn]), ALLEXCEPT(TableName, TableName[GroupCol1], TableName[GroupCol2], ...))
  3. Provide the code in a DAX code block.

Anti-Patterns

  • Do not use SUMMARIZE inside a calculated column to return a table; it causes scalar conversion errors.
  • Do not use FILTER with EARLIER unless specifically requested, as ALLEXCEPT is more efficient and cleaner for this requirement.

Triggers

  • DAX sum over unique combination
  • calculated column sum ignoring column
  • DAX ALLEXCEPT sum
  • Power BI sum for group
  • sum A for unique B C D ignoring E

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.