MONTH

How to Use the Power BI DAX function MONTH

Syntax of the MONTH Function

The syntax of the MONTH function is as follows:


MONTH(❰date❱)


Here, `❰date❱` is the column or expression that represents a date value. The MONTH function extracts the month from the date value and returns an integer value between 1 and 12.

Examples of Using the MONTH Function

Let's take a look at some examples of using the MONTH function in Power BI.

Example 1: Extracting Month from a Date Column

Suppose we have a dataset that contains a column named "Date" that stores date values. We want to extract the month from this column and create a new column named "Month" that contains the month number. To do this, we can use the following DAX expression:


Month = MONTH([Date])


This expression creates a new column named "Month" that contains the month number extracted from the "Date" column. We can now use this column to analyze and visualize data in a report.

Example 2: Using the MONTH Function in a Measure

Suppose we have a dataset that contains a column named "Sales" that stores sales data, and a column named "Date" that stores date values. We want to create a measure that calculates the total sales for each month. To do this, we can use the following DAX expression:


Total Sales = SUM([Sales])

Sales by Month = CALCULATE([Total Sales], MONTH([Date]))


This expression creates a measure named "Sales by Month" that calculates the total sales for each month. The MONTH function is used as a filter to calculate the sales for each month.

The MONTH function in Power BI is a powerful tool that allows you to extract the month from a date value and use it in analysis and visualization. By using this function, you can perform various analyses, such as calculating total sales by month, analyzing trends, and more. We hope this article has helped you understand how to use the MONTH function in Power BI.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)