Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Just trying to use PREVIOUSMONTH function but I always get blanks. Looking through other posts...I am using Auto Time Intelligence and my column is set to type of Date and I see the Date Hierarchy. I cannot set my date dimension as Date Table because I have date gaps in the table entries.
Solved! Go to Solution.
Hi @jfpalumbo123 ,
I think you'd better create a calendar table.
This is my test table:
If I don't create a calendar table, I will get blank result:
CurrentMonth_sales = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Month] = SELECTEDVALUE('Table'[Month])))
PreviousMonth_sales_1 = CALCULATE(SUM('Table'[Sales]),PREVIOUSMONTH('Table'[Date]))
If I create a calendar table:
CalendarTable = ADDCOLUMNS(CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])),"Month",MONTH([Date]))
and create relationship between two tables:
You will get correct result:
PreviousMonth_sales_2 = CALCULATE(SUM('Table'[Sales]),PREVIOUSMONTH('CalendarTable'[Date]))
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Looks like that is what I needed. TYVM!
Hi @jfpalumbo123 ,
I think you'd better create a calendar table.
This is my test table:
If I don't create a calendar table, I will get blank result:
CurrentMonth_sales = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Month] = SELECTEDVALUE('Table'[Month])))
PreviousMonth_sales_1 = CALCULATE(SUM('Table'[Sales]),PREVIOUSMONTH('Table'[Date]))
If I create a calendar table:
CalendarTable = ADDCOLUMNS(CALENDAR(MIN('Table'[Date]),MAX('Table'[Date])),"Month",MONTH([Date]))
and create relationship between two tables:
You will get correct result:
PreviousMonth_sales_2 = CALCULATE(SUM('Table'[Sales]),PREVIOUSMONTH('CalendarTable'[Date]))
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
try not to use Auto Time Intelligence and try to build your own Date table. The easiest way is to create a new table with the code below:
Date = CALENDARAUTO ( )
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
10 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
8 |