Working with ArcGIS Online 9.4 and Portal 10.8.1.
We created a web map in ArcGIS Online with private Portal data and we are using it in an ArcGIS Online dashboard. Don't ask about the reasons it is like this. That's something out of my control.
The fact is that I want to use a data expression in an indicator widget using that same Portal data but it's not working:
My first question is: is it possible to access private Portal data from a data expression in an AGOL dashboard?
And second: is there any map/data requirements that will make the $map global variable available in the arcade editor?
I've done this sort of thing. When I attempt it, I am prompted for my login credentials for the other portal, but I don't know if that's consistent with other users. It does seem possible, though.
To your second question, I'd say "no". I have to wonder if that video was demoing an earlier version of Data Expressions. In the Arcade docs, it's pretty clear:
Note: This profile does not expose any global variables.
The user will be prompted for a portal login as well unfortunately. To circumvent this you would have to have access to the data directly, for example by setting up a collaboration between your portal and AGOL and access the resulting item in your dashboard. However, for the user to be able to see your data it would still require access to the data itself I believe. You could set a view on the AGOL item and share the view with the dashboard user if you want to limit the available fields or features.