Power BI: calculate values per month
To calculate a value based on month, the best is to create a calendar table but it is not mandatory based on your data. Let’s take an example, I have this simple data:
To know how many incidents by month, I will create a column with this formula:
CALCULATE(COUNT('table'[argument1]),'table'[argument2]='table'[argument2])
NOTE: change “table” and “argument” by yours
I will create a table visual (left picture) and for “opened”, I will just keep “month” (right picture):
![]() |
![]() |
This is the result:
Doing the same thing for “closed” (left picture) and to remove the “blank” month, in “filters”, exclude it:
![]() |
![]() |
![]() |
To get all months, I will create a measure with this formula and formatting it as “whole number”:
IF(ISBLANK(COUNT('table'[argument1])),"",COUNT('table'[argument1]))
NOTE: to show 0 instead of blank, change "" by 0
| Opened | Closed | Opened | Closed |
![]() |
![]() |
![]() |
![]() |
Now, in some cases, it is best to use a calendar table instead to use those month columns but before that, I will need to group the data by day, month, etc. based on what I want. As you can see, for instance, the “opened” columns have multiple same values:
- INC001, INC004, INC005 and INC006 have same month
- INC004 and INC005 have same date
- Etc.
To group them, select “opened” then click on “data groups -> new data groups”:
In the popup:
- In “name”, put whatever you want or let it be
- In “bin size”, put 1 and change “days” by “months”
NOTE:
- Since I want to calculate by month, I select “months” to group them monthly but if I want to calculate by day, by year, etc., I have to select the corresponding one
- To group the data weekly and since there is no “week” option, I have to put like that:
- As you have understood, you will have to define the correct number in “bin size” and its type to group the data correctly based on what kind of result you want
Now, I will create a monthly calendar table by clicking on “table tools -> new table”:
Then put this formula:
var FullCalendar = ADDCOLUMNS(CALENDAR(YEAR(NOW())&"/1/1",YEAR(NOW())&"/12/31"),"calendar",FORMAT([Date],"MMMM YYYY")) return SUMMARIZE(FullCalendar,[calendar])
NOTE: for more options, read Power BI: create an automatically updated calendar
Select the “calendar” column then in “data type”, change “text” to “date”:
![]() |
![]() |
I will create a relationship by clicking on “manage relationships”:
Once done, I can use this calendar instead of the “opened” column. Take note that for a better data analysis, it is best to have different calendar tables, for instance, I will create another one for the “closed” column to not use the same as “opened”.
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...

















