web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Report Builder - Calculated field. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate

(0) ShareShare
ReportReport
Posted on by 911

I'm trying to use a calculated field that I've added to my Dataset in Microsoft Report Builder launched from an AL extension built in Visual Studio Code.

I've added the Calculated field ("TimeInDays") OK, (Expression below):-

=iif(Fields!UnitOfMeasure.Value = "DAY", Fields!Quantity.Value, Fields!Quantity.Value * 7.5)

I've dragged it on to the body of the report, OK.

However, when I try and view the report in Business Central, I get the error below:

Rendering output for the report failed and the following error occurred: The Value expression for the text box ‘TimeInDays’ refers to the field ‘TimeInDays’. Report item expressions can only refer to fields within the current dataset scope or, if inside an aggregate, the specified dataset scope. Letters in the names of fields must use the correct case.

anydesk00286.png

Where am going wrong?

I have the same question (0)
  • Suggested answer
    Amit Profile Picture
    2,563 on at

    Hi,

    Pls check this expression in AL code "‘TimeInDays’". If it is there, then publish the extension in sandbox and then open the report editor and assign the variable  "‘TimeInDays’"  in the formula.

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Nick Webb Profile Picture
    911 on at

    Thanks for your response.

    After I've created the calculated field, saved the report, exited MS Report Builder and returned to VSCode, if I then view the .rdl in VSCode I see the TimeInDays Field node in the XML (as below). As soon as I hit Ctrl-F5 to deploy and test it, this Field node disappears, and it errors as previously reported..

    <DataSet Name="DataSet_Result">
       <Query>
          <DataSourceName>DataSource</DataSourceName>
          <CommandText />
       </Query>
       <Fields>
          <Field Name="FirstName">
          <DataField>FirstName</DataField>
       </Field>
    ....
       <Field Name="TimeInDays">
          <Value>=iif(Fields!UnitOfMeasure.Value = "DAY", Fields!Quantity.Value, Fields!Quantity.Value / 7.5)</Value>
       </Field>

    Any thoughts?

  • Nick Webb Profile Picture
    911 on at

    I don't know if this is the text-book solution but, I got round this by adding a couple of dummy columns in the AL Report module as below:

                    column(TimeInDays; gdecTimeInDays) { }

                    column(TimeInHours; gdecTimeInHours) { }
       var
            gdecTimeInDays: Decimal;
            gdecTimeInHours: Decimal;
     
  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    The solution you picked is just the way you have to do it. So a pretty good text-book example in my eyes.

    Keep up the good work!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 690 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 545 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans