How can I validate two columns at the same time and update one of the column values in cognos - cognos

I've requirement to validate two column values and update one of the column values only if both the column value condition saitisfies. To be precise, if column B has value 'system' and column A has blank value then I should update column A value as 'NA'. Can I achieve this Cognos and the values should get displayed in report as well. Thanks.

Data Item [A] Expression
CASE
WHEN [B] = 'system' AND [A] is missing THEN 'NA'
ELSE [A]
END
For this to work, A has to be a string type.

Related

Excel : Sum of Unique values of corresponding column in the filter - Multiple columns in between

I need to have Sum of values in [G] against DISTINCT values of corresponding column [C] in the filter i.e. B
I tried
SUM(UNIQUE(FILTER(G:G, (C:C)*(B:B=I2)))
also tried
SUM(IF(Frequency)))
Here is where using CHOOSECOL will help but you need to use that in the FILTER:
=SUM(INDEX(UNIQUE(FILTER(CHOOSECOLS(A:G,2,3,7),B:B=I2)),0,3))
Now only the three columns are passed to the FILTER output and only those three columns are looked at for the UNIQUE.

excel - extracting value given an array

I wanted to get the value in column A which does not have a certain value on column B. For example, in this picture, given the set in column B when grouped using the value in column A, how can I get the values which does not have "4" in each set?
So the answer that I'm looking for is 2000 and 3000 because they do not have "4" in their respective sets in column B.
Is this achievable? I can't wrap around my head if INDEX and MATCH can do this.
OK well I see that #JvdV reached the same answer as me which is always reassuring. I added a test for blank cells so:
=UNIQUE(FILTER(A1:A20,(COUNTIFS(A1:A20,A1:A20,B1:B20,4)=0)*(A1:A20<>"")))
You could invert the logic if you wanted to but it's a bit longer:
=UNIQUE(FILTER(A1:A20,(COUNTIFS(A1:A20,A1:A20,B1:B20,"<>"&4)=COUNTIF(A1:A20,A1:A20))*(A1:A20<>"")))
=LET(range,A1:B13,
ca,INDEX(range,,1),
cb,INDEX(range,,2),
ua,UNIQUE(ca),
ub,UNIQUE(cb),
all,DROP(REDUCE(0,ub,LAMBDA(x,u,VSTACK(x,ua&u))),1),
alla,DROP(REDUCE(0,ub,LAMBDA(x,u,VSTACK(x,ua))),1),
FILTER(alla,ISERROR(XMATCH(all,ca&cb))))
This doesn't require the 4 as part of the formula and would work on multiple missing numbers
It takes range A1:B13 and divides it into ca (column A) and cb (column B).
And the unique values of these two ranges ua (unique values column A) and ub (unique values column B).
all lists all possible joined combinations of ua and ub.
alla creates the same list, but without joining the ub values to the outcome.
If we then filter alla where the match of all list to joined ca and cb values throws an error (is missing) you get the required result.
In example below I extended the range and 4000 is missing 1:
It repeats the same value if it's missing multiple numbers. Wrap the FILTER in UNIQUE to avoid that if undesired.
You may want to include the missing value as well:
=LET(range,A1:B17,
ca,INDEX(range,,1),
cb,INDEX(range,,2),
ua,UNIQUE(ca),
ub,UNIQUE(cb),
all,DROP(REDUCE(0,ub,LAMBDA(x,u,VSTACK(x,ua&"|"&u))),1),
a,FILTER(all,ISERROR(XMATCH(all,ca&"|"&cb))),
DROP(REDUCE(0,a,LAMBDA(b,c,VSTACK(b,TEXTSPLIT(c,"|")))),1))

In SharePoint calculated column, Get Max(value) based on contents of other columns

In a Sharepoint document library I need to get the max itemnumber+1 if type and role are equal to the value I'm using for a new document.
Type is a choice column with 10 choices;
Role is a choice column with 5 choices;
Itemnumber is a calculated column.
So if I set the column Type to A, and Role to D, then the value of Itemnumber = 2.
If I set the column Type to A, and Role to E, then the value of Itemnumber = 1 (as that combination is not there yet)
I've been trying things like this, bu can't get it to work:
=if(concatinate(FIND([type],[type]),FIND([role],[role])
)
)==concatinate([type],[role])
Any help would be much appreciated
You could use following formula in the calculated column.
=if(And([Type]="A",[Role]="D"),2,if(And([Type]="B",[Role]="E"),3,if(And([Type]="C",[Role]="F"),4,1)))

Find same value in different column and print data of adjacent column using VLOOKUP

I have 4 columns "Column1", "MOVIE_ID", "AVERAGE_RATING" and "RESULT".
I want to check if the row in Column1 has the same data in "MOVIE_ID", and if the data is the same, I want to print show the AVERATING_RATING data again in "RESULT".
For example: if A2 matches any data in MOVIE_ID (in this case it will match B11), I want to print the adjacent AVERAGE_RATING (C11) in the result (D11) which is one the same row of the found MOVIE_ID.
I have this currently =VLOOKUP(A2;$B$2:$B$5001;3) but it doesn't work and I'm not sure why.
This is not easily possible, in the way you ask, because you want to use a variable field in the column A to match a field in the column B and display the result in the same row of B. But you cant set a variable result cell. So the result will be displayed in the cell where the function is.
But fortunately we have an equality relation, so we can switch the variable field and the search column. So we got the function:
=VLOOKUP(B2; $A$2:$C$11; 3; FALSE).
B2 is the variable lookup value.
$A$2:$C$11 is the constant Matrix.
3 is the column index (beginning by 1) of the result value.
FALSE is for a exact match.
So the value of B2 will be searched in the column A.
IF there was a equal value found, the value from the C column will be displayed as a result
ELSE #N/A will be displayed.

Creating a new column of values based on another column

I have a list of values with multiple columns. One of the columns contains values under the format "X-Y" (values are not numerical. There are no other hyphens/"-"s in X or Y. The only hyphen is the separator). I would like to create a new column that contains specific values depending on what X is in this one column.
For example, if X = 'egg', I want it to print out 'bacon' in the column next to it. If X = 'duck', I want the value in the column next to it to be 'bird' instead.
If column A held value egg-quack, I would want the column B next to it to print out bacon. If column A held value egg-duck, I would still want column B to contain the value bacon. If column A held value duck-duck, column B would contain the value bird.
I hope this is clear. How would I be able to go about doing this?
I'm not too familiar with data handling in general, so if there are other more effective methods other than VBA, I'm also willing to look into that.
Thank you!
You can use VLOOKUP for this, with FIND to locate the hyphen:

Resources