ID 23 - Convert the employeename to uppercase

Max: 45
Try code in DAX.do

Syntax

SELECTCOLUMNS UPPER

Related

24 - converts employee names to uppercase and calculates the length of the employee names

SQL

SELECT UCASE(employeename), Salary 
FROM employee;

DAX

EVALUATE
SELECTCOLUMNS(
    employee,
    "EmployeeName_UpperCase", UPPER(employee[employeename]),
    "Salary", employee[salary]
)

Pandas

import pandas as pd

# Sample DataFrame
data = {
    'employeename': ['John Doe', 'Jane Smith', 'Alice Brown'],
    'salary': [70000, 50000, 60000]
}

df = pd.DataFrame(data)

# Convert the employeename to uppercase
df['EmployeeName_UpperCase'] = df['employeename'].str.upper()

# Select the necessary columns
result = df[['EmployeeName_UpperCase', 'salary']].values.tolist()
print(result)

Output

JOHN DOE 70000
JANE SMITH 50000
ALICE BROWN 60000

Explanation

UPPER(employee[employeename]): Converts the employeename to uppercase. SELECTCOLUMNS: Creates a new table with the columns EmployeeName_UpperCase and Salary from the employee table.

Leave a Comment