Forum Discussion

mizan2390's avatar
mizan2390
Super User
4 months ago
Solved

Data could not be retrieved

Hello everyone, I am seeking assistance with a data retrieval error occurring only after publishing a report to the web. The visual works perfectly in Power BI Desktop and within the Power BI Servic...
  • Juan-Power-bi's avatar
    4 months ago

    Excellent diagnosis on your end — you've already identified exactly what's happening. The PowerBIAnonymousArbitraryDaxExpressionException error is a security restriction in the Publish to Web anonymous engine. Microsoft deliberately blocks certain DAX expressions in the public/anonymous context to prevent arbitrary DAX execution by unauthenticated users.
    What gets blocked:

    Visual Calculations — these are evaluated as "arbitrary DAX" from the anonymous engine's perspective because they're dynamic expressions attached to the visual, not pre-defined measures in the semantic model
    Measures used in Reference Lines driven by disconnected tables — the MIN/MAX against your dummy date table apparently also triggers this restriction in anonymous context

    Why it works for authenticated users: Authenticated sessions have a verified identity, so the arbitrary DAX restriction doesn't apply.
    Workarounds:
    The most practical fix is to move the logic out of Visual Calculations and into regular measures in the semantic model. Replace your DataLabel visual calculation with a standard measure that replicates the same logic — pre-defined semantic model measures are whitelisted for anonymous execution.
    For the reference lines, try using static values or date-based measures that don't rely on a disconnected slicer table. If the start/end dates need to be dynamic, you'd need to find a way to express them without MIN/MAX on an unrelated disconnected table in the anonymous context.
    Unfortunately this is a known limitation of Publish to Web and there's no workaround that keeps Visual Calculations working in anonymous mode — it's by design.