Forum Discussion
Learning DAX and DAX studio
Hello All,
I have this simple DAX line
EVALUATE TOPN(10, VALUES(Calendar[DayName]))This column is simply Monday, Tuesday, Wednesday, etc.. and I want to change the case to uppercase. But I can't get the correct syntax correct within DAX Studio
I've tried
EVALUATE TOPN(10, VALUES(UPPER(Calendar[DayName])))which returned an error stating this can happen when a measure formual refers to a column that contains many values....
Not trying to do anything fancy here, just simply play around with functions. What am I missing?
Hi,
Please try something like below.
EVALUATE TOPN ( 10, SELECTCOLUMNS ( ADDCOLUMNS ( VALUES ( 'Calendar'[DayName] ), "@Uppercase", UPPER ( 'Calendar'[DayName] ) ), "Uppercase", [@Uppercase] ) )
3 Replies
- Jihwan_Kim
Super User
Hi,
Please try something like below.
EVALUATE TOPN ( 10, SELECTCOLUMNS ( ADDCOLUMNS ( VALUES ( 'Calendar'[DayName] ), "@Uppercase", UPPER ( 'Calendar'[DayName] ) ), "Uppercase", [@Uppercase] ) )- danman71Regular Visitor
This works, can you explain why you have to do
"@Uppercase", UPPER ( 'Calendar'[DayName] ) .. snip .. ), "Uppercase", [@uppercase]It looks like we are assiging the value of UPPER(calendar[dayname]) to the variable @uppercase, and then returning it at the end? Is that correct?
And why does the table need single ' around it within the function?
- Jihwan_Kim
Super User
Hi,
Thank you for your feedback.
UPPER(Calendar[DayName]) is an expression.
VALUES () function needs a table or column, not expression.
This is why I decided to select one of table contructor functions in DAX.
I hope this helps.