Forum Discussion

rekradha's avatar
rekradha
New Member
1 year ago
Solved

Power BI DAX for computing same 7 same week day and hour average(rolling)

Hi, I am quite new to POWER BI DAX, so I am working on a task to find anomolies in the trend data. The data provided to me is at daily - hourly level across different categories with a KPI value fr...
  • MFelix's avatar
    MFelix
    1 year ago

    Just replace the formula by this one:

     

    Average Value = 
    
            VAR maxdate = MAX('calendar'[Date])
    		VAR dayofwee = WEEKDAY(maxdate)
    		
            RETURN
        DIVIDE (	CALCULATE(
    				SUM('Final -  Dataset'[KPI]),
    				ALL('calendar'),
    				'calendar'[Date] < maxdate && 'calendar'[Date] > (maxdate - (7 * 7)) && 'calendar'[weekday] = dayofwee
    			) ,7)