Showing posts with label heading. Show all posts
Showing posts with label heading. Show all posts

Tuesday, March 27, 2012

Changing Column and Row Heading in MDX

I am trying to change the default row and column heading to make it more meaningful to the user in MDX. Can you please help me.

This is done easily in SQL like

SELECT the_actual_cost AS cost......

Thanks in advance.

Riju

You cannot use aliases in MDX. There are a couple of options though:
1) Select a "friendlier" member property to display instead of the name of the member.
2) Calculated members can be named on the fly.

.. there may be others in 2005 that im not aware of, but these are the ones i've traditionally used.

|||Hi,

Please try WITH SET/ WITH MEMBER option to name column headers.

Niyas|||AFAIK its impossible to retrieve the name of the named set (at least in adomd).|||Thank you all for responding to my question. I was able to rename the column header using calcualted member. However, i am little concerned about the efficiency of this technique. For example i have a measure [date of transaction] and if i want it to be named simply as [date] i have to do [date] as '[date of transaction]'. I am wondering if this will result in slower queries response time?

Thanks
Riju
|||

Why dont you just rename your measure (provided you dont already have a lot of stuff running against this measure)?

|||Hi Peter,

I am using one measure in multiple reports and trying to give them different names in different reports to make it more meaningful.

Thanks
Riju|||

Then calculated members may be the only way..

Changing Column and Row Heading in MDX

I am trying to change the default row and column heading to make it more meaningful to the user in MDX. Can you please help me.

This is done easily in SQL like

SELECT the_actual_cost AS cost......

Thanks in advance.

Riju

You cannot use aliases in MDX. There are a couple of options though:
1) Select a "friendlier" member property to display instead of the name of the member.
2) Calculated members can be named on the fly.

.. there may be others in 2005 that im not aware of, but these are the ones i've traditionally used.

|||Hi,

Please try WITH SET/ WITH MEMBER option to name column headers.

Niyas|||AFAIK its impossible to retrieve the name of the named set (at least in adomd).|||Thank you all for responding to my question. I was able to rename the column header using calcualted member. However, i am little concerned about the efficiency of this technique. For example i have a measure [date of transaction] and if i want it to be named simply as [date] i have to do [date] as '[date of transaction]'. I am wondering if this will result in slower queries response time?

Thanks
Riju
|||

Why dont you just rename your measure (provided you dont already have a lot of stuff running against this measure)?

|||Hi Peter,

I am using one measure in multiple reports and trying to give them different names in different reports to make it more meaningful.

Thanks
Riju|||

Then calculated members may be the only way..

Wednesday, March 7, 2012

Change the Column Heading on select statement

I have a problem I don't know if there's a way to solve it.

I have a store procedure with 2 parameter the first parameter is the booking ID which I used in the where statement the other one is the type "D" for Driver and "H" for helper actually they are on the same table I'm asking is it possible to change the column heading in the select below as you can see the "AS [DRIVER NAME]" what if the type passed is type "H" means is it possible to change it to "[HELPER NAME]" on the same select statement.

SELECT Booking_ID AS [BOOKING ID], UPPER(Lastname_VC)+', '+Firstname_VC+' '+Middlename_VC AS [DRIVER NAME] FROM Boo_DrvHlp_T INNER JOIN Boo_TripHist_T
ON Boo_DrvHlp_T.Employee_ID=Boo_TripHist_T.Employee_I D AND Boo_TripHist_T.Type=@.Type WHERE Booking_ID=@.BookingID

thanks.RE: I have a problem I don't know if there's a way to solve it.
I have a store procedure with 2 parameter the first parameter is the booking ID which I used in the where statement the other one is the type "D" for Driver and "H" for helper actually they are on the same table I'm asking is it possible to change the column heading in the select below as you can see the "AS [DRIVER NAME]" what if the type passed is type "H" means is it possible to change it to "[HELPER NAME]" on the same select statement.
SELECT Booking_ID AS [BOOKING ID], UPPER(Lastname_VC)+', '+Firstname_VC+' '+Middlename_VC AS [DRIVER NAME] FROM Boo_DrvHlp_T INNER JOIN Boo_TripHist_T
ON Boo_DrvHlp_T.Employee_ID=Boo_TripHist_T.Employee_I D AND Boo_TripHist_T.Type=@.Type WHERE Booking_ID=@.BookingID thanks.

Q1 [Is it possible to have a result set heading e.g. , 'DRIVER NAME', conditionally appear as something else e.g. , 'HELPER NAME', depending on a passed parameter being either 'D' or 'H'?]
A1 Yes. Assign the passed parameter to a variable in the stored procedure; use a Case statement to evaluate and appropriatly use either 'DRIVER NAME' or 'HELPER NAME' in your result header column.

the logic [psudocode] amounts to something like:
Case @.vPassedParameter = 'H'
Then @.vColumnHeader = 'HELPER NAME'
Case @.vPassedParameter = 'D'
Then @.vColumnHeader = 'DRIVER NAME'