If you get the "This dataset wont be refreshed" error in PowerBi online and the dataset refreshes fine in PowerBi Desktop, then one reason maybe in how you are using Web.Contents.
The first thing you should do is check your "Data Source Settings" in PBI-Desktop and check to see if you get the "Some data sources may not be listed because of hand-authored queries". (See: https://docs.microsoft.com/en-us/power-bi/connect-data/refresh-data#refresh-and-dynamic-data-sources for more info)
Here is some code that caused this error for me:
uri = "https://login.microsoftonline.com/" & tenantID & "/oauth2/token",
xxx = Web.Contents(uri, [Headers = authHeaders, Content = Text.ToBinary(authQueryString)])
The problem with the above code is that PBI service does not like to refresh URLs that are computed on the fly. So to fix the above code all you have to do is, pass the dynamic parts as a RelativePath, like so:
uri = "https://login.microsoftonline.com/",
relativePath = tenantID & "/oauth2/token",
xxx = Web.Contents(uri, [RelativePath =relativePath, Headers = authHeaders, Content = Text.ToBinary(authQueryString)])
More info: https://docs.microsoft.com/en-us/powerquery-m/web-contents