Create column from another column with multiple values in the rows - sql

I want to filter values but the rows contain multiple values. So here is an example of what I want to create.
I want to create a column where rows that contain multiple values equals to 1 value.
Example:
A row that contains Konsulent, Hovedsertifisør, Hovedkonsulent, konsulent to respond to just Hovedsertifisør for example.
I tried the related dax, if else statements

As given in your example I assume that the "," defines multiple values, not the " ".
Use this Calculated Column
Column =
IF(
SEARCH(",", 'Table'[Name], 1, BLANK()),
"Hovedsertifisør",
'Table'[Name]
)

Related

Coldfusion loop and remove rows if a particular row type exists

column names: mastertransid, type_internal_id_int
Query returns 3 rows. For type_internal_id_int the value can either be SalesOrd, ItemShip or CustInvc
mastertransid is the same for all 3 rows and groups the three together
However if there is a record for type_internal_id_int and it = CustInvc then I need to hide the other two rows.
I've tried grouping my data using <cfoutput group by="type_internal_id_int"> without any luck.
From the image I have included, I don't want customers to see SalesOrd or ItemShip, if a CustInvc value exists.

Select rows from a dataframe where a column does not take one of the values in a list

I have a list of values that is a subset of all values that a specific column can take:
list1=['DHL','FDX','UPS','USPS','Others']
Based on the value of the shipping company used for a shipment, I can choose rows (for example):
df2=df1[df1['ShippingCompany']=='DHL']
Now, I need to select 'Others', where rows correspond to all shipping companies other than the one listed before 'Others'. How do I do this without having to write a long chain? Mind you, list1 contents can change between invocations, where customers can add other values before 'Others'.
I am thinking of the following metacode:
df2=df1[df1['ShippingCompany'] is not in list1[:-1]]
Is this possible in Python?
You have isin or ==
df2=df1[df1['ShippingCompany'] == list1[-1]]
More than two value
df2=df1[~df1['ShippingCompany'].isin(list1[:-1])]

SSRS - How to get column value by column name

I have one table with rows and each row has a column that contains a field name (say raw1 - 'Number001', raw2-'ShortChar003', etc). In order for me to get that value of these fields I have to use a second table; this table has 1 raw with many columns (number001, Number002, ShortChar003, etc).
How can I extract the value?
Good Question..You can use lookup function
=Lookup(Fields!CityColumn.Value, Fields!CityColumn.Value, Fields!CountColumn.Value, "Dataset1")
Or you might have to use string functions..ex LEFT, Substring, Right same like SQL.If possible pls post some data of both tables, I will explain in detail

Edit first item of dynamic rows in ssrs?

My ssrs has three row groups nested, and in one of the rows the report runs many times.
I'd like to add something simple to the rows, such as "%" at the end, but only on the first row returned, not the rest of the dynamic rows. My idea was to use:
=RowNumber("detailsGroup") but all that returns is one for each row. Is there another SSRS method?
I was also thinking of using the "is" operator and comparing the dynamic values to the First operator, but running the report gave #ERROR.
If you are using groups you should be able to use Previous() function.
EXample:
Group 1 - ClientName
Group 2 - Region
Group 3 - SubRegion
Detail - data for above 3 groups
If I just want to add something in one of the detail data then I would use ..
=Fields!CallReason.Value + IIF(Previous(Fields!ClientName.Value) <> Fields!ClientName.Value , " Add Text For First Line", "")

How to get MAX Values using the Having Clause in MS Access

I have a Column(Fields) that contain multiple values for each entity (One to Many).
Example: A record can can reference multiple values in this column.
What I want to do is get only records where highest(MAX) value in this column is equals zero.
The first thing I did was convert the values in the column to Integer, this way I can get the Max Value.
Here is my Code:
How do I get the Max code? If a record has more than one code. I want only record with the Max or highest code of 00000.
I am getting an error with the Having clause since I cannot use Aggregate in the Where Clause.
SELECT CUSTOMER.USER_ID, MAX(CInt(CUSTOMER.REC_CODE)) AS ACTIVE_REC_CODE,
CUSTOMER.CUS_TYPE
FROM CUSTOMER
WHERE ((CUSTOMER.REC_CODE) IS NOT NULL )
GROUP BY
CUSTOMER.USER_ID, CUSTOMER.REC_CODE, CUSTOMER.CUS_TYPE
HAVING MAX(CInt([CUSTOMER.REC_CODE])= 00000 )
You are close, but you need to remove CUSTOMER.REC_CODE from your WHERE, since you want the max value of that column. This should work:
SELECT CUSTOMER.USER_ID, MAX(CInt(CUSTOMER.REC_CODE)) AS ACTIVE_REC_CODE, CUSTOMER.CUS_TYPE
FROM CUSTOMER
WHERE CUSTOMER.REC_CODE IS NOT NULL
GROUP BY CUSTOMER.USER_ID, CUSTOMER.CUS_TYPE
HAVING MAX(CInt([CUSTOMER.REC_CODE])) = 0