Answered by:
Max Of length of the column name in ssrs

Question
-
Hi,
I need to get the maximum length of the given result set for particular column. Suppose in my result set One column(Ex. Name) having the values Raj, Mano,Dinesh. In this i have to get maximum length of that column values. Means my expression should return as 6. Because Dinesh length is 6 and it is the maximum. I used Max(Len(Fields!Name.Value)). It is not working.
- Edited by SQL MSBI Monday, August 10, 2015 6:40 AM
Monday, August 10, 2015 6:40 AM
Answers
-
If you wanted to find out the maximum length used you could use as following:
SELECT TOP 1 name, DATALENGTH(packagedata) FROM dbo.sysdtspackages ORDER BY 2 DESC
In you present context ,max(Len(fields!name.value))
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/
- Proposed as answer by Qiuyun YuMicrosoft contingent staff Sunday, August 16, 2015 11:40 AM
- Marked as answer by Qiuyun YuMicrosoft contingent staff Wednesday, August 19, 2015 3:48 AM
Tuesday, August 11, 2015 4:35 AM -
Hi SSRS 2008 R2,
In your scenario, since you don’t specify the scope in the Max() function, the current scope is used. So please specify the scope that contains the report item to which to apply the aggregate function. Please refer to screenshots below:
Reference:
Max Function (Report Builder and SSRS)If you have any question, please feel free to ask.
Best regards,
Qiuyun YuQiuyun Yu
TechNet Community Support- Proposed as answer by Ahsan KabirMVP Tuesday, August 11, 2015 4:28 AM
- Marked as answer by Qiuyun YuMicrosoft contingent staff Wednesday, August 19, 2015 3:48 AM
Tuesday, August 11, 2015 2:44 AM
All replies
-
Hello - All you need to do is to add another row "Outside of Group", merge the cells (To make them one cell) & use the expression to get MAX(LEN), refer screen below:
Hope this helps !
Good Luck!
Please Mark This As Answer if it solved your issue.
Please Vote This As Helpful if it helps to solve your issueMonday, August 10, 2015 7:42 AM -
Try this expression
MAX(Len(Fields!Name.Value))
Please Dont forget to mark as answer. It helps others to find relevant posts to the same question. Milan Das
Monday, August 10, 2015 8:22 AM -
Hi SSRS 2008 R2,
In your scenario, since you don’t specify the scope in the Max() function, the current scope is used. So please specify the scope that contains the report item to which to apply the aggregate function. Please refer to screenshots below:
Reference:
Max Function (Report Builder and SSRS)If you have any question, please feel free to ask.
Best regards,
Qiuyun YuQiuyun Yu
TechNet Community Support- Proposed as answer by Ahsan KabirMVP Tuesday, August 11, 2015 4:28 AM
- Marked as answer by Qiuyun YuMicrosoft contingent staff Wednesday, August 19, 2015 3:48 AM
Tuesday, August 11, 2015 2:44 AM -
If you wanted to find out the maximum length used you could use as following:
SELECT TOP 1 name, DATALENGTH(packagedata) FROM dbo.sysdtspackages ORDER BY 2 DESC
In you present context ,max(Len(fields!name.value))
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/
- Proposed as answer by Qiuyun YuMicrosoft contingent staff Sunday, August 16, 2015 11:40 AM
- Marked as answer by Qiuyun YuMicrosoft contingent staff Wednesday, August 19, 2015 3:48 AM
Tuesday, August 11, 2015 4:35 AM