Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Power BI DAX Previous month data returns null

I have 2 measure created in SiteUsage table
TotalData = AVERAGEX(SiteUsage ,SiteUsage [Storage_Used_GB]) and

another measure to calculate previous month data
Last_Month_Data = CALCULATE([TotalData],PREVIOUSMONTH(Calendar_Table[Date]))

I have created a custom date table and form [1 to Many] relationship with SiteUsage table as well
Still the Last_Month_Data returns the null data why?

relationships based on same format Date/Time columns

definition of calendar table

Calendar_Table =

VAR

_startDate = EDATE(TODAY(),-60)

VAR

_endDate = EDATE(TODAY(),60)

Return

ADDCOLUMNS(

CALENDAR(_startDate, _endDate)

,"Year",YEAR([Date])

,"Month",FORMAT([Date],"mmm" )

,"WeekNO",WEEKNUM([Date],2))

2 Replies