My data looks like
Name country Group Date Score
a UK IT 18/11/2016 1
a UK IT 19/11/2016 -1
a UK IT 20/11/2016 2
a UK IT 21/11/2016 2
a UK IT 22/11/2016 NA
a UK IT 23/11/2016 NA
a UK IT 24/11/2016 NA
a UK IT 25/11/2016 NA
a UK IT 26/11/2016 NA
b UK VK 18/11/2016 1
b UK VK 19/11/2016 -1
b UK VK 20/11/2016 1
b UK VK 21/11/2016 1
b UK VK 22/11/2016 1
b UK VK 23/11/2016 -2
b UK VK 24/11/2016 2
b UK VK 25/11/2016 1
b UK VK 26/11/2016 -1
I made a Group By operation averaging the score column based on 'Name', 'Country', 'Group' columns in power query(Power BI) then the data looks like
Name country Group Average Score
a UK IT 0.44
b UK VK 0.33
But I'm trying to get average scores as "NA" when there are >=4 Na's in Score column for every person which may look like
Name country Group Average Score
a UK IT NA
b UK VK 0.33
I couldn't find solution using Group by directly, any ideas or suggestions? (Power BI also supports R, any transformations that can be done to achieve this?) Thanks in advance.
This can be accomplished with
dplyr
as follows.