Mann-Kendall Test
Hmm Anonymous, try this for frequency:
__freq = VAR ComplaintsByFiscalMo = ADDCOLUMNS(VALUES(PMS_COMPLAINT[FISCAL_MON_START_DT]),"CountComplaints", CALCULATE(COUNTROWS(PMS_COMPLAINT))) VAR __table = GROUPBY(ComplaintsByFiscalMo,[CountComplaints],"__ties",COUNTX(CURRENTGROUP(),[FISCAL_MON_START_DT])) VAR __table1 = ADDCOLUMNS(__table,"__ties1",[__ties] - 1) VAR __table2 = ADDCOLUMNS(__table1,"__freq",IF([__ties1]=0,0,[__ties1]*([__ties1]+1)*(2*[__ties1]+7))) RETURN SUMX(__table2,[__freq])
I should probably break my bad habit of using SUMMARIZE.
Hi Greg, aka DAX Guru.
the dax is spot on an gives the correct end result.
The only problem i can see with the whole Mann Kandell calculation for __s and __freq is when you have blank data points.
In R you have to input 12 data point for 12 months and months with no data are shown as 0 not blank. So how do you get around this in DAX or how can i amend my formula to add 0 to the table below.
R Input top part of screen and results bottom part.
Power BI Issues to over come
The Mann kandell falls apart when you have less then 12 data points. if we have 12 data points all the values are 100% spot on with R.
- Greg_Deckler7 years ago
Community Champion
If you need the freq measure to have a value of 0 instead of BLANK for the values in question, you should be able to do this:
__freq = VAR ComplaintsByFiscalMo = ADDCOLUMNS(VALUES(PMS_COMPLAINT[FISCAL_MON_START_DT]),"CountComplaints", CALCULATE(COUNTROWS(PMS_COMPLAINT))) VAR __table = GROUPBY(ComplaintsByFiscalMo,[CountComplaints],"__ties",COUNTX(CURRENTGROUP(),[FISCAL_MON_START_DT])) VAR __table1 = ADDCOLUMNS(__table,"__ties1",[__ties] - 1) VAR __table2 = ADDCOLUMNS(__table1,"__freq",IF([__ties1]=0,0,[__ties1]*([__ties1]+1)*(2*[__ties1]+7))) VAR __sum = SUMX(__table2,[__freq]) RETURN IF(ISBLANK(__sum),0,__sum)
- Anonymous7 years agoNot applicableLet me run this against R. And compair outputs..many thanks.
- Anonymous7 years agoNot applicable
Give this man a knigth hood.............................................................
ok one last quesion, on your original dash board as below how can you add the mann Kandell Tau calculation. see below. same data.....same values.
- Greg_Deckler7 years ago
Community Champion
Assuming that you are referring to Kendall's Tau Quick Measure here: https://community.powerbi.com/t5/Quick-Measures-Gallery/Kendall-s-Tau/m-p/625107.
The short answer is that given the original data that I used for this Mann-Kendall Test, I don't believe I can add Tau to it. The reason is that Kendall's Tau requires two sets of values. In the example above, I used "Interviewer1" and "Interviewer2". These were both columns of values. In the Mann-Kendall Test original data, I only have 1 set of values.
Sooo...I could add another set of values to the data and go that route. Otherwise, if I were to use the single column of values for both concordant and discordant pairs, I would end up with a calculation of 1 for Kendall's Tau. Of course, I wouldn't need to do the calculation in that case, I would just create a measure like Tau = 1. :)