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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Sum the result from a LookupSet without using Custom Code because of RDL Sandboxing

(0) ShareShare
ReportReport
Posted on by

Hi there,

In a Dynamics 365 Online environment, I've written a report which needs to establish the total number of records that are still Open and Within SLA. I have a field in my dataset called "SLAStatus" and it's value is set to OpenInSLA, OpenOutSLA, ClosedInSLA or ClosedOutSLA.

My approach is to use the LookupSet function, and return 0 or 1 depending on the value of the SLAStatus field.

As the LookuupSet function returns an array of values, I've then used the code from Salvo's blog (http://salvoz.com/blog/2013/05/27/sum-result-of-ssrs-lookupset-function/) to create the "SumLookup" function which then adds all the values in the resulting LookupSet array.

A complication is that my dataset is larger than 50,000 records, so I have split my datasets by their geographic location (called "CCC" - Client Care Centre) and thus have the resulting expression in my report:

=Sum(

Code.SumLookup(

LookupSet(Fields!CCC.Value, Fields!CCC.Value, iif(Fields!SLAStatus.Value = "OpenInSLA", 1, 0), "CCC_1")

) +

Code.SumLookup(

LookupSet(Fields!CCC.Value, Fields!CCC.Value,iif(Fields!SLAStatus.Value = "OpenInSLA", 1, 0),"CCC_2")

)

)

The above works perfectly, except I cannot upload this now to the Dynamics 365 Online platform, given the restriction of RDL Sandboxing which I've just discovered does not permit any custom code within an RDL file.

I've tried replicating the login of the custom SumLookup function within the actual expression, however no matter where I try to "sum" or "convert.todecimal" etc, I'm just not getting it right - I keep getting an error.

I've been toying with the idea of replacing all the "sum" login with merely a "countif", but haven't figured this out yet either.

Any and all suggestions welcomed!! :)

*This post is locked for comments

I have the same question (0)
  • Verified answer
    wi11iamr Profile Picture
    on at

    I've taken inspiration from a couple other suggestions and instead of sum'ing the number of instances of the SLAStatus that I'm looking for, to instead:

    1. Join the array as a complete string

    2. Take the length of the full string and subtract from it the length of the amended string where the SLAStatus value I'm looking for is replaced with ""

    3. Divide the result by the length of the string that was replaced

    It feels *really* clumsy, but it appears to do the job.

    I'm still open to more elegant suggestions, however the code I'm now using is as follows:

    =(Len( Join(LookupSet(Fields!CCC.Value, Fields!CCC.Value, Fields!SLAStatus.Value, "CCC_1"),",") )

    -Len(

    Replace(Join(LookupSet(Fields!CCC.Value, Fields!CCC.Value, Fields!SLAStatus.Value, "CCC_1"),","), "ClosedOutSLA,", "", 1) ))

    / 13

  • bhupendra Profile Picture
    167 on at

    Hi William,

    I am facing the similar issue with online platform.

    Actually, i have multiple datasets in my report. To show values, i have used lookup function and was able to show values from multiple datasets onto a single row. However, while doing sum of those lookup values, i am facing lot of issues. Join will not work in my case as i want to calculate all the values.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans