Count active weeks across years with SELECTCOLUMNS and DISTINCT

Pick a year and week number for every sale with SELECTCOLUMNS, remove duplicates with DISTINCT, and count the weeks that had sales.

You will learn to

  • Shape a table with SELECTCOLUMNS
  • Remove duplicate rows with DISTINCT
  • Count combinations that need more than one column to be unique

How it works

`SELECTCOLUMNS(table, "Name", expression, …)` returns a table with **only** the columns you ask for, one row for each row of the original. Inside it you are in row context, so `RELATED` can fetch values from the one side, just like in `SUMX`.

`DISTINCT(table)` removes duplicate rows. Applied to a one-column table it is a list of unique values; applied to a two-column table it keeps unique **pairs**.

That matters whenever one column isn’t unique on its own. Week numbers restart every January, so week 10 of 2024 and week 10 of 2025 share the number 10. Count the distinct week numbers and you merge the two years; count distinct year–week pairs and you get the real number of weeks.

Practice it hands-on with a real data model and a live report that updates as you type.

Active Region-Months =
COUNTROWS(DISTINCT(SELECTCOLUMNS(Sales, "Region", RELATED(Customer[Region]), "Month", RELATED('Date'[Month Year]))))