I've run into an issue with the WEBI report I am making. Here is the code in question:
=If([Group Change Task Status Desc] = "Open")
Then([Count of GCT])
ElseIf([Group Change Task Status Desc] = "Complete" And [SH Open Date Actual Dt] >= [Current Date - 60] And [SH Open Date Actual Dt] <= [Current Date])
Then([Count of GCT])
This is very basic and straight forward code. Count the O's and count the C's when they fall between the two dates.
This is the error I'm getting:
Formula Evaluation - Error in
dataset values : #MULTIVALUE
Check formula definition in this
dataset context
I've determined the error is because of this part of the code:
And [SH Open Date Actual Dt] >= [Current Date - 60] And [SH Open Date Actual Dt] <= [Current Date]
I've tried it without this line and I get no errors. But the obvious problem is that I get too much data counted for the C's.
I hope I provided enough info. Like I said, its pretty straight forward code. But this is my first time using WEBI and I need more experienced eyes on it.
The #MULTIVALUE error means, given the context (dimensions) in your block, the formula in your variable is returning two or more figures, and WebI does not know how to aggregate them (assuming that the variable you've created is a measure).
You'll notice that if you add more dimensions to your block, such as [Group Change Task Status Desc], [Current Date - 60] and [SH Open Date Actual Dt], the #MULTIVALUE error eventually disappears and the figures will appear instead.
You can try to solve this by manually specifying the aggregation to be used (e.g. SUM). Thus, if your variable is called [Count C and O], you'd add SUM() to it, resulting in SUM([Count C and O]).
There's also a section on #MULTIVALUE in the Web Intelligence manual Using functions, formulas and calculations in Web Intelligence which you can find here.
Related
I am stuck with some mysterious issue while trying to get Revenue for Current Month.
My Limitation is Simple :
I need Current Month Revenue Without Having to do any selections.
So here are the details :
Data_Date field has two values one for Dec, and one for Nov 2016
11/15/2016
12/15/2016
I have declared a variable vCurrent_Month
=Date#( Max(Data_Date))
Value in Variable is correctly Reflecting 12/15/2016
Given below is my Set Analysis Expression used in Text Object:
=Sum({1<Date#(Data_Date)={"(vCurrent_Month)"}>}TOTAL_REVENUE)
I am getting following error
Error: Error in set modifier expression
I have been stuck for hours and I have tried several tutorials and ways to get the same result but there seems to be no way out. Any help is highly appreciated.
Thanks
Try this:
=Sum({1<Data_Date={'$(vCurrent_Month)'}>}TOTAL_REVENUE)
Trying to do the number formatting in the first part of the set analysis is what is causing the error message you're getting.
After that to get it to work you need to make these changes:
You left out the $() expansion then the variable won't evaluate and you used double quotes which will return a field name rather than a value
I am using icCube 5.0.1 and in the process of upgrading to 5.1.
I am attempting to use the Builder to create a Calculated Measure using the following formula: DaysBetween([LastReportingDate], Today())
[Measure].[LastReportingDate] is a measure within the cube with a Date data type.
The purpose is to create a calculated measure that provides the number of days between [Measure].[LastReportingDate] and today and use it within a report.
When I add the new calculated measure to a report table, the column cells are filled with 'error', and when I hover over a cell the error message reads: DaysBetween(): argument (0) type mismatch: expected 'date' got: 'measure'.
Manual reference: http://www.iccube.com/support/documentation/mdx/DaysBetween.php
Any hints? Many thanks!
Can you use the memberValue property:
DaysBetween([LastReportingDate].MemberValue, Today())
(p.s. I use Pyramid not icCube so this may be way of the mark!)
Assuming the [LastReportingDate] is a time dimension (i.e., with the member key being an actual date (and not a string representing a date) ) you can do the following:
DaysBetween( [LastReportingDate].KEY, Today() )
In case [LastReportingDate] is a [Measures] of type Date, you can use the Value() function to get its actual date as following:
DaysBetween( [Measures].[LastReportingDate].Value, Today() )
Note: If the key is a string, please edit your question with its pattern description.
After more research and experimentation, I solved the problem as follows:
I used the following formula for the calculated variable: Today()-[LastReportingDate]
I used the following Cell Properties entry: Format_String = '#,##0' Note that without using the the Format_String, the report displayed a date.
Thanks to all for your assistance.
I'm trying to write a function of this form:
Function cont(requestdate As Date)
cont = requestdate
End Function
Unfortunately, when I enter =cont(12/12/2012) into a cell, I do not get my date back. I get a very small number, which I think equals 12 divided by 12 divided by 2012. How can I get this to give me back the date? I do not want the user to have to enter =cont("12/12/2012").
I've attempted to google for an answer, unfortunately, I have not found anything helpful. Please let me know if my vocabulary is correct.
Let's say my user pulled a report with 3 columns, a, b and c. a has beginning of quarter balances, b has end of quarter balances and c has a first and last name. I want my user to put in column d: =cont(a1,b1,c1,12/12/2012) and make it create something like:
BOQ IS 1200, EOQ IS 1300, NAME IS EDDARD STARK, DATE IS 12/12/2012
So we could load this into a database. I apologize for the lack of info the first time around. To be honest, this function wouldn't save me a ton of time. I'm just trying to learn VBA, and thought this would be a good exercise... Then I got stuck.
Hard to tell what you are really trying to accomplish.
Function cont(requestdate As String) As String
cont = Format(Replace(requestdate, ".", "/"), "'mm_dd_YYYY")
End Function
This code will take a string that Excel does not recognize as a number e.g. 12.12.12 and formats it (about the only useful thing I can think of for this UDF) and return it as a string (that is not a number or date) to a cell that is formatted as text.
You can get as fancy as you like in processing the string entered and formatting the string returned - just that BOTH can never be a number or a date (or anything else Excel recognizes.)
There is no way to do exactly what you're trying to do. I will try to explain why.
You might think that because your function requires a Date argument, that this somehow forces or should force that 12/12/2012 to be treated as a Date. And it is treated as a Date — but only after it's evaluated (only if the evaluated expression cannot be interpreted as a Date, then you will get an error).
Why does Excel evaluate this before the function receives it?
Without requiring string qualifiers, how could the application possibly know what type of data you intended, or whether you intended for that to be evaluated? It could not possibly know, so there would be chaos.
Perhaps this is best illustrated by example. Using your function:
=Cont(1/1/0000) should raise an error.
Or consider a very simple formula:
=1/2
Should this formula return .5 (double) or January 2 (date) or should it return "1/2" (string literal)? Ultimately, it has to do one of these, and do that one thing consistently, and the one thing that Excel will do in this case is to evaluate the expression.
TL;DR
Your problem is that unqualified expression will be evaluated before being passed, and this is done to avoid confusion or ambiguity (per examples).
Here is my method for allowing quick date entry into a User Defined Function without wrapping the date in quotes:
Function cont(requestdate As Double) As Date
cont = CDate((Mid(Application.Caller.Formula, 7, 10)))
End Function
The UDF call lines up with the OP's initial request:
=cont(12/12/2012)
I believe that this method would adapt just fine for the OP's more complex ask, but suggest moving the date to the beginning of the call:
=cont(12/12/2012,a1,b1,c1)
I fully expect that this method can be optimized for both speed and flexibility. Working on a project now that might require me to further dig into the speed piece, but it suits my needs in the meantime. Will update if anything useful turns up.
Brief Explanation
Application.Caller returns a Range containing the cell that called the UDF. (See Caveat #2)
Mid returns part of a string (the formula from the range that called the UDF in this case) starting at the specified character count (7) of the specified length (10).
CDate may not actually be necessary, but forces the value into date format if possible.
Caveats
This does require use of the full dd/mm/yyyy (1/1/2012 would fail) but pleasantly still works with my preferred yyyy/mm/dd format as well as covering some other delimiters. dd-mm-yyyy or dd+mm+yyyy would work, but dd.mm.yyyy will not because excel does not recognize it as a valid number.
Additional work would be necessary for this to function as part of a multi-cell array formula because Application.Caller returns a range containing all of the associated cells in that case.
There is no error handling, and =cont(123) or =cont(derp) (basically anything not dd/mm/yyy) will naturally fail.
Disclaimers
A quick note to the folks who are questioning the wisdom of a UDF here: I've got a big grid of items and their associated tasks. With no arguments, my UDF calculates due dates based on a number of item and task parameters. When the optional date is included, the UDF returns a delta between the actual date and what was calculated. I use this delta to monitor and calibrate my calculated due dates.
All of this can absolutely be performed without the UDF, but bulk entry would be considerably more challenging to say the least.
Removing the need for quotes sets my data entry up such that loading =cont( into the clipboard allows my left hand to F2/ctrl-v/tab while my right hand furiously enters dates on the numpad without need to frequently (and awkwardly) shift left-hand position for a shift+'.
I have two dimension properties "Project Start" and "Project End" that belong to my [Project] dimension. They stand for the start and end date of my projects. Now I want to use these values with MDX, or to be more precisely, in an IIF statement in my query. I want to now if one or both properties are after or before some parameters (projectstart ([Time].[Year - Month - Day].[Month].&[2012-01-01T00:00:00]) and projectend).
So I started to try things like this:
Format([Project].[ParentProject].CURRENTMEMBER.PROPERTIES("Project End"), "yyyy-mm-dd") > StrToMember("[Time].[Year - Month - Day].[Month].&[2012-01-01T00:00:00]")
[Time].[Year - Month - Day].[Month].&[2012-01-01T00:00:00].MEMBER_KEY > [Project].[ParentProject].CurrentMember.Properties("Project End")
CDate([Time].[Year - Month - Day].[Month].&[2012-01-01T00:00:00].MEMBER_KEY) > CDate([Project].[ParentProject].CurrentMember.Properties("Project End"))
But either I get an error or the wrong case of the IIF-statement is executed. After chechkig up MSDN what I get from "[Project].[ParentProject].CurrentMember.Properties("Project End")" I'm more than confused now. On the one hand it says that I will get a string, but on the other hand (if there is a TYPED in the property definition) I should get back the data type of the value (in this case DateTime). I wonder what is right now and/or if I understood the MSDN wrong.
Maybe somebody can help me to clear that up and give me a hint how I can work with these properties.
Okay, after spending some more time on finding the answer I have changed my MDX query quite a lot. This resulted in the fact, that I ended up with a query including the Format function and "yyyy-mm-dd" as aiming format. But the conversion didn't work and said, that it can't convert my property value into a date. The returned value of the property was at least for a human recognisable as a date (I wrote a simple MDX query to have a look at what I get).
So obviously the data type of a dimension property seems really to be a string.
I have a formula that takes value from query data
Now, I want to skip the formula if the query data is 0
Example: [value1]-[value2]/[value1]*100
If the [value1] is 0, skip the formula.
First of all, Pentaho Report Designer have build-in Formula Editor, which can greatly simplify your life when constructing these formulas. Not sure starting which version it available, but in 3.6.1 it's for sure.
Also in Pentaho Wiki you may find a useful page describing Formula Expressions: http://wiki.pentaho.com/display/Reporting/Formula+Expressions
As for your particular issue, I think this formula should work:
=IF([value1] = 0; ""; [value1]-[value2]/[value1]*100)
Starting equal sign is required in each formula!
By observing your formula, [value1] field is there in the denominator, there might be a chance to get zero(0) for that field. This is logical error.
If you handle that one, you can overcome this error.
For your case this formula would work.
= ( [value1]-[value2]/ IF(OR(ISEMPTYDATA([value1]); [value1] = 0) ;1;[value1]) )*100
I had an error where I used one date type as type "Date" and another as "Date(SQL)" where I used the first parameter with format "Date" to derive the other parameter with format "Date(SQL)" through a formula. Which came back to bite me.