Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kip
Regular Visitor

Cumulative currency conversion with YTD and Lookupvalue problem

Hi

 

I would need some help with an issue I'm facing and I don't understand.

 

In my simplified model I have 3 tables (2 sales tables just to demonstrate the issue); Date; exchange rates and sales table.

 

 

Data model.PNG

 

My target is to calculate cumulatively local amounts by month and then use month's exchange rate to convert the amount to reporting currency. And then subtract previous month's cumulative amount of latest amount to have isolated monthly value in reporting currency.

 

I get correct result in PBI Test Sales 2 table with its measures RateYTD 2. That seems to be because that table has one-to-one relationship with date table. If I have many-to-one relationship with date table (PBI Test Sales) then same measure (RateYTD) is not working in the way I like it to work. It is just multiplying isolated months with the exchange rate. Unfortunately I need to have many-to-one relationship there.

Problem.PNG

My measures are same for both tables:

 

SalesMeasure2 = SUM('PBI Test Sales 2'[Sales])

Sales YTD 2 = CALCULATE([SalesMeasure2]; DATESYTD('Table'[Date]))

Rate 2 = SUMX('PBI Test Sales 2'; [SalesMeasure2]*
    LOOKUPVALUE('PBI Test rate'[Rate];'PBI Test rate'[YYMM]; 'PBI Test Sales 2'[YYMM]))

RateYTD 2 = SUMX('PBI Test Sales 2'; [Sales YTD 2] * LOOKUPVALUE('PBI Test rate'[Rate]; 'PBI Test rate'[YYMM];'PBI Test Sales 2'[YYMM]))

What can be the case here? Why is it behaving like that?

 

Link to PBI example I used:

 

https://www.dropbox.com/s/kxfaq7zhbhg6cvt/Currency%20rate%20test.pbix?dl=0

 

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @kip,

 

You can try to use below measure to calculate YTD sales:

Measure =
SUMX (
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'PBI Test Sales' ),
            [Date] <= MAX ( [Date] )
                && YEAR ( [Date] ) = YEAR ( MAX ( [Date] ) )
                && [Version] IN ALLSELECTED ( 'PBI Test Sales'[Version] )
        ),
        [YYMM],
        [Date],
        [Version],
        [Sales],
        "Rate", LOOKUPVALUE (
            'PBI Test rate'[Rate],
            [YYMM], VALUE ( FORMAT ( [Date], "yymm" ) )
        )
    ),
    [Sales] * [Rate]
)

11.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @kip,

 

You can try to use below measure to calculate YTD sales:

Measure =
SUMX (
    SUMMARIZE (
        FILTER (
            ALLSELECTED ( 'PBI Test Sales' ),
            [Date] <= MAX ( [Date] )
                && YEAR ( [Date] ) = YEAR ( MAX ( [Date] ) )
                && [Version] IN ALLSELECTED ( 'PBI Test Sales'[Version] )
        ),
        [YYMM],
        [Date],
        [Version],
        [Sales],
        "Rate", LOOKUPVALUE (
            'PBI Test rate'[Rate],
            [YYMM], VALUE ( FORMAT ( [Date], "yymm" ) )
        )
    ),
    [Sales] * [Rate]
)

11.PNG

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.