Forum Discussion

lmb218's avatar
lmb218
New Member
11 months ago
Solved

Error fetching data for this visual - Running sum

I have a report with a number of visualisations in it. Some of them are line charts with a running sum calculation.

The underlying data is from Excel tables stored in SharePoint.

 

In the Desktop version, everything looks great.

 

However, when I publish to my workspace, generate an embed code, and then view the link in a browser or embed the code in a SharePoint page, the visualisations with the running sum only throw an error. I have tried the same visualisations without the running sum (just the standard Count), and in that case they display as expected.

 

I'm very new to PowerBI, so please be gentle. I'm sure you need more information, but I would be grateful for any suggestions.

  • lmb218's avatar
    lmb218
    11 months ago

    Thank you for the suggestions. I ended up scrapping using running totals for the visuals. Instead I used a measure to calculate the cumulative totals, and used that in the visuals instead. It works perfectly now.

     

    Cumulative Applications AY = 
    VAR CurrentAY = SELECTEDVALUE(StudentMIData[Academic Year])
    VAR CurrentMonth = MAX(AcademicMonthsScaffold[Academic Month Number])
    RETURN
    CALCULATE(
        [Applications],
        FILTER(
            ALLSELECTED(StudentMIData),
            StudentMIData[Academic Year] = CurrentAY
                && StudentMIData[Academic Month Number] <= CurrentMonth
        )
    )

7 Replies

  • HI lmb218 

     

    Could you share how your 'Cumulative Application' on the line chart visual was calculated? This would matter becuase the error says '403 error (PowerBIAnonymousArbitraryDaxExpressionException)'. I'm suspecting the evaluation context in your DAX was lost. 

  • Hi lmb218

    Thank you for reaching out to the Microsoft Fabric Community Forum. Also, thanks to MasonMA, for his inputs on this thread. I can see why this is confusing since everything works fine in Desktop but not after publishing.

    The error you are seeing (PowerBIAnonymousArbitraryDaxExpressionException) happens because Publish to Web (anonymous embed) does not support certain custom DAX expressions, like the ones used in running totals. That’s why your cumulative visuals fail while simple counts still display. You have got a few options to fix this.

    Try rewriting your running total measure using built-in time intelligence functions like TOTALYTD or DATESYTD, instead of using FILTER + ALLSELECTED. These are more stable in the Service.

    If you need the visuals to always work with cumulative totals, I would recommend using App-based sharing or Secure Embed instead of Publish-to-Web. Publish-to-Web has limitations for security and advanced DAX.

    If Publish-to-Web is a must, you could pre-calculate cumulative totals in Power Query/Excel before loading the data.
    Kindly refer these links:
    https://learn.microsoft.com/en-in/power-bi/collaborate-share/service-embed-secure 
    https://learn.microsoft.com/en-in/power-bi/collaborate-share/service-publish-to-web#considerations-and-limitations 

    Nothing is wrong with your Desktop model the limitation only applies when embedding anonymously. Switching to secure embed or tweaking your DAX should solve it.

    Hope this clears it up. Let us know if you have any doubts regarding this. We will be happy to help.

    Thank you for using the Microsoft Fabric Community Forum.

    • lmb218's avatar
      lmb218
      New Member

      Thank you for the suggestions. I ended up scrapping using running totals for the visuals. Instead I used a measure to calculate the cumulative totals, and used that in the visuals instead. It works perfectly now.

       

      Cumulative Applications AY = 
      VAR CurrentAY = SELECTEDVALUE(StudentMIData[Academic Year])
      VAR CurrentMonth = MAX(AcademicMonthsScaffold[Academic Month Number])
      RETURN
      CALCULATE(
          [Applications],
          FILTER(
              ALLSELECTED(StudentMIData),
              StudentMIData[Academic Year] = CurrentAY
                  && StudentMIData[Academic Month Number] <= CurrentMonth
          )
      )
    • v-kpoloju-msft's avatar
      v-kpoloju-msft
      Community Support

      Hi lmb218,

      Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.

      Thank you.

      • v-kpoloju-msft's avatar
        v-kpoloju-msft
        Community Support

        Hi lmb218,

        Hope you had a chance to try out the solution shared earlier. Let us know if anything needs further clarification or if there's an update from your side always here to help.

        Thank you.