Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
marktait
Helper I
Helper I

PreviousMonth not returning any data

Hi.

 

I'm trying to setup a simple table using the PreviousMonth function.

 

The two measures are setup as follows:

 

  • Risk Score Calc = average(Defender[Risk Score - %Total])
  • Risk Score Calc Prev = calculate([Risk Score Calc],PREVIOUSMONTH(Defender[Extract Month]))
My table in PBI is setup and correctly showing the "Risk Score Calc", however the "Risk Score Calc Prev" is not showing any data:
 
Setup in PBI.PNG
 
"Extract Month" is setup as a date:
 
PBI Date.PNG
 
Can anyone see why "Risk Score Calc Prev" is not showing any data?
 
Thanks for any help,
 
Mark
 
 
1 ACCEPTED SOLUTION
CoreyP
Solution Sage
Solution Sage

Power BI is built so that it best functions when models are in a star schema. Time intelligence functions require this, specifically a date dimension table. You need to create a date dimension table, establish a relationship to your fact table, and adjust your DAX measure to utilize the date table. 

View solution in original post

4 REPLIES 4
marktait
Helper I
Helper I

Thank you very much - that solved the issue.

 
 
CoreyP
Solution Sage
Solution Sage

Power BI is built so that it best functions when models are in a star schema. Time intelligence functions require this, specifically a date dimension table. You need to create a date dimension table, establish a relationship to your fact table, and adjust your DAX measure to utilize the date table. 

Hi Corey - thank you for the suggestion.

 

I created a date table, which lists all days (monthly), including all dates in my "Defender (facts)" table:

 

Dates.PNG

 

I linked them as follows:

 

DateListTable.PNG

 

..and I changed the calculation to:

Risk Score Calc Prev = calculate([Risk Score Calc],PREVIOUSMONTH(DateListTable[Dates]))
 
However, the table still remains the same, with the Prev column unpopulated.
 
Thanks again for any help,
 
Mark

Date tables need to have a contiguous series of dates. ( Each row is a day, not a month. ) Use the function CALENDAR with FIRSTDATE and LAST DATE to create a dynamic date table with a contiguous set of dates.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.