Forum Discussion
Correlation Coefficient DAX Measure Error
- 3 years ago
Anonymous Is this what you are looking for? See PBIX attached below signature.
90 Days Rolling Average 2012-2023 2 = VAR NumOfDays = 90 VAR LastCurrentDate = MAX ( 'DimDate'[Date] ) VAR Period = DATESINPERIOD ( 'DimDate'[Date], LastCurrentDate, - NumOfDays, DAY ) VAR Result = AVERAGEX(FILTER('BioSales', [Date] <= LastCurrentDate && [Date] >= LastCurrentDate - 90),[2012-2023 Average]) VAR FirstDateInPeriod = MINX ( Period, 'DimDate'[Date] ) VAR LastDateWithSales = MAX ( 'BioSales'[Date] ) RETURN IF ( FirstDateInPeriod <= LastDateWithSales, Result )
Anonymous Is this what you are looking for? See PBIX attached below signature.
90 Days Rolling Average 2012-2023 2 =
VAR NumOfDays = 90
VAR LastCurrentDate =
MAX ( 'DimDate'[Date] )
VAR Period =
DATESINPERIOD ( 'DimDate'[Date], LastCurrentDate, - NumOfDays, DAY )
VAR Result =
AVERAGEX(FILTER('BioSales', [Date] <= LastCurrentDate && [Date] >= LastCurrentDate - 90),[2012-2023 Average])
VAR FirstDateInPeriod = MINX ( Period, 'DimDate'[Date] )
VAR LastDateWithSales = MAX ( 'BioSales'[Date] )
RETURN
IF ( FirstDateInPeriod <= LastDateWithSales, Result )
- Anonymous3 years agoNot applicable
The gods have spoken...let me check and feedback. Sir.
- Anonymous3 years agoNot applicable
Hi Greg, the values in measure __Roll90D are correct until we reach 02 April 2012 then after that point the numbers (whats expected goes out of sink with the excel check) .. expected results are in the image body of question. i need to hit those number as shown for May and Jun 2012
__Roll90D2 to also close but again goes out of sink 02 April 2012.
- Anonymous3 years agoNot applicable
final values
- visheshjain3 years agoImpactful Individual
Hi Anonymous & Greg_Deckler,
Spitballing here!
Could it be that the numbers are different from the desired output, as there are dates where the correlation is blank.
Since we are calculating the dates - 90 days in the date table, even the days where the correlation is blank, are being considered.
On the other hand the desired output is ignoring the days, where the correlation is blank and hence the difference in numbers.
Hope this helps.
Thank you,
Vishesh Jain
- Anonymous3 years agoNot applicable
The excel formula is correl(a2:90,b2:b90) rolling forward...