I have an Rdlc report
In this report I have a field which takes its values by this expression
(Round(((First(Fields!Occurs.Value) / First(Fields!TotalDistance.Value))* 10000),2)
but in some cases (TotalDistance.Value) = 0 so the previous expression returns Infinity,
So I need to get the next record in case of that field equals 0 ,
If also next field equals 0 , I want to get the next one
I looked for way of getting next record but didn't find
I only found (First , Last) methods,
How can I do that ?
instead of using First or Last if you don't care which record as long as it isn't 0 then couldn't you use an aggregate function. ex:
(Round(((First(Fields!Occurs.Value) / MAX(Fields!TotalDistance.Value))* 10000),2)
you could use Max, Min or Avg to get a value. I am unaware of any way within the rdlc to loop through the records like you are asking.
Another completely different way could be to load the data into a datatable then add a column to contain the calculated value and use some code to calculate the values before being passed to the report.
Related
I'm trying to implement a filter where the user can select either a parameter to use as a filter or use a dimension to filter the report. So I've done something like,
Case [paramter]
When 1 then [Order Date] = [date parameter]
When 2 then [dimension] = [dimension]
End
When paramter value is 1, we filter based on date parameter but we can still use the dimension to filter the report as well. The reason I'm not using another parameter to filter for the second case is so that the user can search for a particular value from a very long list. How do I make it so that the dimension filter doesn't affect the report if the case value is set to 1 or is there a way for the user to search for a particular value in a parameter?
i've the following formula the problem i've is, this isn't working as it should be.
=SUMIFS(E9:14,$I$16:$I,FALSE(),$H$16:$H,G8)
E9:E14 is the part which should be summed up when the checkbox in I16:I = FALSE and if the name matches in H16:H from G8. My problem is I am getting this error
The array arguments of "SUMIFS" vary in size
My question would be, how do I get this exact formula to work? Exactly these areas have to be covered and cannot be changed, otherwise everything else is broken.
EDIT: Added example spreadsheet
https://docs.google.com/spreadsheets/d/1DdTSZAfGTpoeun3k2qqkDMG1jnaUaSz6wgSf2heIIDI/edit?usp=sharing
You need to adjust your ranges. Here's how =SUMIFS() works and then you'll see why you need to adjust the function.
=SUMIFS() looks for ranges and then applies the logic. So when you are telling the function to summarise E9:E14 it interprets it as:
SUM(E9,E10,E11,E12,E13,E14)
provided the following conditions. The conditions will tell the function whether to include each of the components (i.e. E9,...,E14).
Whether a condition is met or not is decided using a simple boolean (true/false) array. This could for example be I9:I14=FALSE which is interpreted as the array
{IF(I9=FALSE),IF(I10=FALSE),...,IF(I14=FALSE)}
resulting in an array similar to this:
{TRUE,TRUE,FALSE,FALSE,FALSE,TRUE}
(assuming the conditions I9, I10 and I14 are met but not the other three. The same is done for the second condition (the values in column H being equal to the value in G8, resulting in another array similar to this:
{TRUE,FALSE,FALSE,TRUE,FALSE,TRUE}
(assuming that only the values in H9, H12 and H14 are equal to G8.
When the function compares the two condition arrays and returns an aggregate array similar to this:
{TRUE,FALSE,FALSE,FALSE,FALSE,TRUE}
because only for the first and the last value the conditions are met. Therefore the =SUM function becomes like this:
SUM(E9,FALSE,FALSE,FALSE,FALSE,E14)
where FALSE = 0 so it returns
=SUM(E9,E14)
Here's where you get into trouble
You try to pass the function conditional arrays that are of a different size to the sum array (E9:E14), in effect asking it to compare apples and the age of your neighbour. What you need to do is to create the calculation you have in column E in a new column in rows 24 down and use that as the sum range in =SUMIFS().
I want to know if my value is included in an interval consisting of the previous row and the next row. How to do it in Talend?
I tried a tMemorizeRow function where I save 3 lines each time, but encountered a java.lang.NullPointerException exception as when I am on the first line it does not know the next row I saved.
What am I missing?
You can try this : add a column "sequence" with value as Numeric.sequence("s1",1,1)to your data : this way you'll know this exact order between rows in your flow (you can do it in a tMap). Redirect the tMap to a tHashOutput component (if you can't find in the palette, add it through Project Parameters>Designer>Palette>Technique , this component is hidden by default).
Then you'll need an other subjob, with 3 tHashInput : one for your main flow, and the two others as lookup : then you'll be able to join rows with previous and following one , thanks to your 'sequence' field.
Then in tMap_2 you'll be able to compare values from mainFlow with Previous and Next flows.
I have two sets of data in columns A and B. I would like to pick the maximum value from column A which is also less than the value in the corresponding row in column B. I think I ought to be able to do this with the MAXIFS function but all the examples I can find compare against static values. I tried these options
=MAXIFS(A1:A10, B1:B10, "<")
=MAXIFS(A1:A10, B1:B10, A&"<"&B)
but neither of them worked as expected. In the first case, it is always 0 suggesting the condition is never met, in the second it gives an error.
I know that I could do this by creating a separate region of cells which first filter out the data that doesn't match the conditional and then simply pick the max from what remains but I'd rather do it in a single cell if possible.
Is there a syntax for this comparison and, if so, what is it?
To the best of my knowledge there isn't a way of getting it to work with MAXIFS.
You can write this
=maxifs(A:A,A:A,"<"&B:B)
and it will accept it, but it just uses the first value in column B and doesn't do a side-by-side comparison.
So you have to do it another way e.g. with a combination of Max and If:
=ArrayFormula(max(if(A:A<B:B,A:A)))
or you can use max with a filter or query:
=max(filter(A:A,A:A<B:B))
=max(query(A:B,"select A where A<B"))
=ARRAY_CONSTRAIN(ARRAYFORMULA(
IF(LEN(INDIRECT(ADDRESS(ROW(), COLUMN(B:B))))>0,
IF(INDIRECT(ADDRESS(ROW(), COLUMN(B:B)))<MAX($A$1:$A),
MAX($A$1:$A), LARGE(UNIQUE($A$1:$A), 2)), )), 1, 1)
This seems to be a simple problem that I cannot get around. I have the following formula (works fine).
=MEDIAN(FILTER('Filtered-Data'!$D$4:$D,'Filtered-Data'!$C$4:$C=B3))
What I want is to use ArrayFormula to get a column wise result for the range B3:B instead of just B3
Can this be done?
First idea was to use Google QUERY function, however it does not support standard SQL SELECT ... WHERE... IN (valA,valB...) clause. However thing you want is achievable with ARRAYFORMULA. The trick is to match appropriately two columns, handle errors, and apply appropriate filtering (multiline for readability):
=MEDIAN(FILTER(Filtered-Data'!$D$4:$D,
ARRAYFORMULA(IF(IFERROR(MATCH
(Filtered-Data'!$D$4:$D,'Filtered-Data'!$C$4:$C=B3:B,0),0)>0,TRUE,FALSE))))
Explanation:
ARRAYFORMULA(MATCH(col1,col2,0)) finds in array first row containing value matching criteria, 0/1 determines whether matching starts from top or bottom. For standalone use, MATCH stops after producing first result. Applying ARRAYFORMULA on MATCH gets us close to what we want - it produces an array of results. However, if item is not matched, error is returned, so you get something like below, in a column:
N/A
2
3
1
3
2
N/A
N/A
N/A
1
3
These N/A stuff will do us no good, since we always want some kind of row number. Here comes IFERROR, which replaces all N\A with good ol' "0": IFERROR(MATCH(col1,col2,0),0)
Google Spreadsheet never counts rows from "0" (it starts from "1", only offsets are zero-based), so this is pretty safe unless your data contains "0" - than change it to anything else safe for your case.
Since FILTER expects in filtering_criteria single column array of booleans or expression that evaluates to array of booleans (https://support.google.com/drive/table/25273?hl=en ) we need to make sure ARRAYFORMULA produces such array of booleans. IF comes in handy - always produces either TRUE or FALSE: IF(IFERROR(MATCH(col1,col2,0)>0,TRUE,FALSE)
Now re-apply ARRAYFORMULA on that stuff, to work on array & render an array result instead of single result: ARRAYFORMULA(IF(IFERROR(MATCH(col1,col2,0)>0,TRUE,FALSE)) and put it inside FILTER... voila, it works.
For reference see: http://productforums.google.com/forum/#!topic/docs/PpnZinkLzQs