Forum Discussion
marktait
2 years agoHelper 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 ...
- 2 years ago
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.
marktait
2 years agoHelper I
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:
I linked them as follows:
..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
CoreyP
2 years agoSolution Sage
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.