Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Convert a sales value to the reference currency with the exchange rate of a specific date


Convert a sales value to the reference currency with the exchange rate of a specific date

Author
Message
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
I Have 2 Dimensions: Time and Currency

I also have to fact tables, exchange rate and sales

Both fact tables have references to Time and Currency Dimension.

The user want to select using excel the sales in the local currency and the correspondent conversion in the reference currency (the reference currency is fixed) in the selected date.

To obtain the desired exchange date I need a date and a currency. The user select in excel a specific date but the currency must be the current currency in the sales table. I achived something like this in the query editor:


with

MEMBER [Measures].[Current Rate To Euro] AS (
([ISO Currencies].[ISO Curr Code].CurrentMember, [Time].[Date Id].CurrentMember, [Measures].[Exchange Rate To Euro]))

MEMBER [Measures].[Net Sales Euro] AS (
[Measures].[OOH Net Sales Dom Snapshot]/[Measures].[Current Rate To Euro]
)

SET NE_measures as {[measures].[Net Sales Value Domestic], [Measures].[Exchange Rate To Euro]}

member m_NonEmptyCheck as
Generate
(
NE_measures
,{Iif([Measures].CurrentMember, [Measures].CurrentMember, NULL)}
).Count = NE_measures.Count
,NON_EMPTY_BEHAVIOR =
(
{[measures].[Net Sales Value Domestic], [Measures].[Exchange Rate To Euro]}
)

select {[Measures].[Net Sales Euro], [Measures].[OOH Net Sales Dom Snapshot],[Measures].[Current Rate To Euro]} on 0,
Filter(
{[ISO Currencies].[ISO Curr Code].[ISO Curr Code]}*{[Time].[Date Id].&[2581]*[Customers].[PDU Description].[PDU Description]}
,m_NonEmptyCheck
) on 1
from [DM ISR DEV];




But I don't know how to translate the last select in a calculated measures in order to let the customer only to select this measures in the values area and the time in the filters.

Any comment would be appreciated

Kind Regards

Paul Hernández
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Was not so difficult as I thought, however, it took me several hours to understand how could it work:


with

MEMBER [Measures].[Current Rate To Euro] AS (
([ISO Currencies].[ISO Curr Code].CurrentMember,[Time].[Date Id].CurrentMember, [Measures].[Exchange Rate To Euro]))

MEMBER [Measures].[Net Sales Euro] AS (
SUM([ISO Currencies].[ISO Curr Code].[ISO Curr Code],([Measures].[OOH Net Sales Dom Snapshot]/[Measures].[Current Rate To Euro]))
)

select {[Measures].[Net Sales Euro], [Measures].[OOH Net Sales Dom Snapshot],[Measures].[Current Rate To Euro]} on 0,
non empty {[Time].[Date Id].&[2580]} -- specific datatime, in my db is the 23 Jan. 2014
*{[Customers].[PDU Description].[PDU Description]} on 1 -- An attribute of the customer hier.
from [DM ISR DEV]
;




I think all of my confusions come from my Sql background. A calculated member is a member that is resolved by calculating an MDX expression to return a value, not a set, for this reason the key to solve my problem was the SUM function.

Paul Hernández
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search