Daily DAX : Day 304 STARTOFMONTH

Power BI DAX STARTOFMONTH Function

Description

The STARTOFMONTH function in DAX (Data Analysis Expressions) returns the first date of the month for a given date or date column. It is commonly used in Power BI for time intelligence calculations, such as aggregating data at the start of a month or comparing month-to-date metrics.

Syntax

STARTOFMONTH(<dates>)
  • <dates>: A column reference containing dates, or a function/expression that returns a date.

Return Value

A single date representing the first day of the month for the input date, in datetime format (e.g., 2025-08-01 00:00:00 for any date in August 2025).

Use Case

STARTOFMONTH is useful for:

  • Calculating month-to-date metrics (e.g., sales from the start of the month).
  • Grouping or filtering data by the first day of each month.
  • Creating time-based comparisons, such as comparing current month performance to previous months.

Example

Suppose you have a table Sales with a column OrderDate. You want to create a measure to calculate total sales from the start of the month for each date.

SalesFromStartOfMonth = 
CALCULATE(
    SUM(Sales[Amount]),
    DATESBETWEEN(
        Sales[OrderDate],
        STARTOFMONTH(Sales[OrderDate]),
        MAX(Sales[OrderDate])
    )
)
    

This measure sums the Amount column from the first day of the month up to the selected date.

Notes

  • The input must be a valid date column or expression.
  • Works best with a date table marked as a Date Table in Power BI for accurate time intelligence.
  • Time portion of the output is set to midnight (00:00:00).

Related Functions

  • STARTOFQUARTER: Returns the first date of the quarter.
  • STARTOFYEAR: Returns the first date of the year.
  • ENDOFMONTH: Returns the last date of the month.

Comments

Popular posts from this blog

Daily DAX : Day 65 INFO.TABLEPERMISSIONS

Daily DAX : Day 55 PV