问题
With the limitations of Business Objects (Launchpad 4.1 SP6), I need to construct a pie chart. Simple enough but the dataset I'm required to use contains a code field that is evaluated, and depending on the string value returned, another field is summed (accrued minutes of a given activity described by the return code value).
For instance [Code] returns "BRK1" meaning break and evaluating to a number 15 (indicating 15 minutes). Another [Code] returns "LUNCH" and evaluating to the number 60 (indicating a 60 minute lunch). These types of codes return "Subtractive Codes", meaning they represent time subtracted from Scheduled Work. Within the same [Code] field are also codes describing work segments. For example: [Code] returns "SB_PHN_SOUTH" indicating a "shift bucket" that evaluates to 540 minutes. The shift buckets are "Additive Codes".
So, given these business and programmatic rules, I have a dataset that looks like this:
EWFMCodeSelect EWFMPieChart
BREAK 2425685
DISC 443075
MISS 83476
NEUTR 2700
NODISC 582787
SHIFT 16120299
This can be easily turned into a pie chart but with one major error. All of the groups, BREAK, DISC, MISS, NEUTR and NODISC are all Subractive and belong in the numerator. The code SHIFT is the denominator. SHIFT represents 9 hours of shift time, breaks and such subtract from the shift time so an accurate pie chart would show each subtractive bucket as a percentage of the whole "SHIFT" time.
I have two variables to group values into buckets for evaluation and summation:
=If([Code]InList("BRK1"; "BRK2"; "BRK3"; "LUNCH" )) Then"BREAK"
ElseIf([Code]InList("TEAM"; "MTG"; "PROJ"; "TRNG")) Then "DISC"
ElseIf([Code]InList("LATE";"NOSHOW";"UNPAID";"UPVAC")) Then "MISS"
ElseIf([Code]InList("COACH")) Then "NEUTR"
ElseIf([Code]InList("VAC";"LOA";"SICKUP";"SICKPL")) Then "NODISC"
Else("SHIFT")
and then:
=If([EWFMCodeSelect]="BREAK") Then Sum([TimeDiff (ToInt)]ForEach([Clndr Date];[Time-Interval];[Agent Login];[Code]))
ElseIf([EWFMCodeSelect]="DISC") Then Sum([TimeDiff (ToInt)]ForEach([Clndr Date];[Time-Interval];[Agent Login];[Code]))
ElseIf([EWFMCodeSelect]="MISS") Then Sum([TimeDiff (ToInt)]ForEach([Clndr Date];[Time-Interval];[Agent Login];[Code]))
ElseIf([EWFMCodeSelect]="NEUTR") Then Sum([TimeDiff (ToInt)]ForEach([Clndr Date];[Time-Interval];[Agent Login];[Code]))
ElseIf([EWFMCodeSelect]="NODISC") Then Sum([TimeDiff (ToInt)]ForEach([Clndr Date];[Time-Interval];[Agent Login];[Code]))
ElseIf([EWFMCodeSelect]="SHIFT") Then Sum([TimeDiff (ToInt)]ForEach([Clndr Date];[Time-Interval];[Agent Login];[Code]))
I've tried various techniques to Sum("SHIFT")-(InList("All other codes")) but I either get a #MULTIVALUE error (regardless of what Context Operators I've tried) or some other type of incorrect return value.
I've found no posts here or elsewhere describing a similar problem (or solution) so I'm hoping some fine Business Objects Webi expert here can suggest a path to solution.
Thank you for your consideration!
回答1:
I would suggest working towards a standard tabular table to get the values you want, then convert it to a Pie Chart from there.
Based on your description, I assume the values that you want to see in your chart are:
EWFMCodeSelect
BREAK 15.0%
DISC 2.7%
MISS .5%
NEUTR .0%
NODISC 3.6%
This function should get you the percentages:
=[TimeDiff]
/ NoFilter(( Sum([TimeDiff]
ForAll([EWFMCodeSelect])
Where ([EWFMCodeSelect] = "SHIFT"))))
Since you don't want a pie for [SHIFT]
, you will need to put a filter on the block to exclude it (The NoFilter()
function in the formula brings [SHIFT]
back in for evaluation)
来源:https://stackoverflow.com/questions/37466659/business-object-pie-chart-conundrum