MS Access 2013 DSum calculated field DSum returns #error - ms-access-2013

OK, I have searched for an answer in the usual places, and tried several fixes (i.e. quote syntax, field type) but have still not found a solution to this issue...
I have a calculated field in Access 2013 in a query as follows:
CumGPA: DSum([TermGPA],[Transcript_Info],"[Sequence]<=" &[Sequence])
Give a running sum of TermGPA for every row from the Transcript_Info table where Sequence is less than or equal to the current row's value
I get the unhelpful #Error returned.
TermGPA and Sequence are Fixed Decimal
Any ideas? I could be staring right at it, but I've been on a long programming binge and can't see straight right now.

CumGPA: DSum("TermGPA","Transcript_Info","Sequence<=" &[Sequence])

Related

Confirm my attempt at converting Crystal reports selection criteria to Oracle SQL

I have to create selection criteria for an Oracle SQL query based on a snippet from Crystal Reports.
I have no experience with Crystal reports so I have been trying to figure it out searching the web, but seem to be just wasting my time - Could not find anything helpful for this kind of task on the web.
This is the selection criteria that was provided:
{MATL_USED_VW.MAT_ID} = {?Material ID} and
{#Use Date} in {?Previous Use}
//#UseDate = Date({MATERIAL_ACTIVITIES.MA_END})
The column data types are all date columns except for the numeric MAT_ID column
I think this would equate to the following:
where matl_used_vw.mat_id = :Material_id
and use_date in (:previous_use, :usedate)
This is just a swag based on assumptions.
Here's my assumptions on the symbols:
? - probably is a parameter or prompt for input
# - has something to do with formulas
// - is continuation of previous line
{} - encloses an object (text, date number or whatever)
I'm not sure of anything here, it's all just a guess.
If anyone could shed some light on this, I would really appreciate it!
Thanks for the help on this!
Here's the answer in case some other schmuck unfamiliar with Crystal reports needs a similar answer:
# is a Formula. In this case, to convert text to date.
? is a Parameter In this case it represents a range
// is a remark. Same as # or ‘ in other languages.
{} - encloses an object (text, date number or whatever)

Google Sheets/Excel: Checking if a time falls within a range

I'm trying to find a way to see if I can find a way to determine if a time that I stipulate falls between two other times. For example:
Start End
11:33:48 11:53:48
12:20:22 12:38:21
12:39:27 13:00:09
14:16:23 14:20:49
14:20:54 14:22:56
Then, I want to check if a cell (here the value of 12:50 in cell E30) falls between ANY two values in a range in THE SAME ROW. For me, I can get the obvious way to check for this in one row, and this simple version totally works:
=If(AND(E30>A4,E30<B4), "TRUE", "FALSE")
However, I want to check if that number falls within ANY of the values within the ROWS above cells in a range, and I can't get that to work. For example, I tried this and it didn't work:
=If(AND(E30>A:A,E30<B:B), "TRUE", "FALSE")
I also tried a simple countif variation but that didn't do it either:
=COUNTIFS(A:A,">"&E30,B:B,"<"&E30)
Any advice on how to adjust one of these formulas to get it to work?
Try switching the angle brackets around:
=COUNTIFS(A:A,"<"&E30,B:B,">"&E30)
I think this should work for the above data set -
=IF((FILTER(A2:B6, D2>A2:A6,D2<B2:B6)),TRUE,FALSE)
This will give you if there is any match or not.
For the number of rows count that match -
=ROWS((FILTER(A2:B6, D2>A2:A6,D2<B2:B6)))
Alomsot =IF(Q2>R2,IF(AND($X$16>HOUR(Q2),$X$16<(HOUR(R2)+12)),1,0),IF(AND(HOUR($X$14)>=HOUR(Q2),HOUR($X$14)<=HOUR(R2)),1,0))

Google Sheets COUNTIF syntax across different tabs

I am currently trying to work out how to make the current Google Sheets version of COUNTIF properly count how many times the value of a cell (C3) is higher than the value if another cell (E3), according to the following formula:
=COUNTIF('4'!$C$3,">'4'!$E$3")
You'll note that the formula is run in a different tab than the one where the cells being counted are located in (which is named "4"). The formula returns a zero '0', when it should be returning a one '1', as the value in '4'!$C$3 actually is higher than the value in '4'!$E$3.
Clearly, I am doing something wrong.
So, the user I'-'I (stackoverflow.com/users/8404453/i-i) suggested the following edit:
=COUNTIF('4'!$C$3,">'4'!$E$3") --> COUNTIF('4'!$C$3,">"&'4'!$E$3)
This suggestion resolved my issue.

Report Builder Expressions

Im new to Report Builder and having issues with some expressions that Im trying to implement in a report. I got the standard ones to work however as soon as I try any distinctions, I get error messages. Over the last couple weeks, Ive tried many combinations, read the expression help, google and looking at other questions at internet sites. To reduce my frustrations, I even would jump to other expressions and walk away hoping I would have different insight coming back.
Its probably something simple or something I dont know about writing expressions.
Im hoping that someone can help with these expressions; they are the versions I get the least errors with(usually just expression expected) and show what Im trying to accomplish.
=IIF((Fields!RECORDFLAG.Value)='D',COUNTDISTINCT(Fields!TICKETNUM.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and (Fields!RECORDFLAG.VALUE)='A' or
'B',SUM(Fields!DOLLARS.Value),0)
=IIF((Fields!TRANSTYPE.Value)='1' and
(Fields!RECORDFLAG.VALUE)='P',SUM(Fields!DOLLARS.Value),0)
=Sum([DOLLARS] case when [RECORDFLAG]='P' then -1*[DOLLARS])
Thank You.
=IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICK‌​ETNUM.Value))
The error message gives you the answer here - no false part of the iif() has been specified. Use =IIF((Fields!RECORDFLAG.Value)=”D”,COUNTDISTINCT(Fields!TICK‌​ETNUM.Value), 0)
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE)="A" or "B",SUM(Fields!DOLLARS.Value),0)
This is not how an OR works in SSRS. Use:
=IIF((Fields!TRANSTYPE.Value)="1" and (Fields!RECORDFLAG.VALUE="A" or Fields!RECORDFLAG.Value = "B"),SUM(Fields!DOLLARS.Value),0)
The 0s are returned due to your report design. countdistinct() is an aggregate function - it's meant to be used on a set of data. However, your iif() is only testing on a per row basis - you're basically saying "if the current row is thing, count all the distinct values" which doesn't make sense. There are a couple of ways forward:
You can count the number of times a certain value occurs in a given condition using a sum(). This is not the same as the countdistinct(), but if you use =sum(iif(Fields!RECORDFLAG.Value = "D", 1, 0)) then you will get the number of times RECORDFLAG is D in that set. Note: this requires the data to be aggregated (so in SSRS, grouped in a tablix).
You can use custom code to count distinct values in a set. See https://itsalocke.com/aggregate-on-a-lookup-in-ssrs/. You can apply this even if you have only one dataset - just reference the same one twice.
You can change the way your report works. You can group on Fields!RECORDFLAG.Value and filter the group to where Fields!RECORDFLAG.Value = "D". Then in your textbox, use =countdistinct(Fields!TICKETNUM.Value) to get the distinct values for TICKETNUM when RECORDFLAG is D.

Crystal Report displaying formula result as 00

First of all I would like to apologize if this has been asked before, I just couldn't find the answer.
To the point:
My problem is as follows: I am using Crystal Reports for VS2010 and I have a field that should dispaly 1 or -1 based on an If check
If IsNull ({Orders.OrderReplacedBy})
Then 1
Else -1
It should display in my report 1 for null values of the field and -1 otherwise. Problem is that in my report I get only .00 no matter the value of the if test.
Furthermore I have another formula field that does of a sum of all the 1s and -1s showed on the report, and it seems to be working a little weird. In my database I have 772 total rows, of which 39 are NULL (so there should be 733 1s and 39 -1s with a sum of 694) and the displayed sum is 488. The code for the sum is as follows:
Sum({#N})
where N is the field where I calculate the 1s and -1s.
What I've tried so far:
changed the If test from IsNull to ToText({Orders.OrderReplacedBy})=""
changed the If test to {Orders.OrderReplacedBy}>0 as the OrderReplacedBy field in the database is numeric and there cannot be values less than zero, so the NULLs should just trigger the Else.
trid to change the display of the formula to "1" and ToNumber("1") nothing seems to work
I honestly have no more ideas of what else to try and I also have no knowledge of Crystal Reports (I am only working with it for 2 days and just need to modify a report on an existing app).
Any help would be appreciated,
Thanks :)
P.S.: I am working with Silverlight 4
Since no one answered I presume that this hasn't happened to anyone or isn't of much interest. But after doing some more research and trying out other stuff I've found a workaroud that I'll post (maybe someone else bumps to this, who knows?):
In the N formula (I don't know why it didn't work the last time I tried) I changed things like this:
If IsNull({Orders.OrderReplacedBy})
Then "1"
Else "-1"
Added a new formula that isn't used on the report called Numbers
If {#N}="1"
Then 1
Else -1
And then I changed the sum formula to match the intermediate field
Sum({#Numbers})
I still don't know the reason why the report didn't want to show me the numbers in the N formula, nor why the sum formula didn't calculate the correct sum.
I hope this is at least going to be useful to someone else,
Cheers!

Resources