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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
sclencioco
Helper I
Helper I

sum of values with different currency

Hello,

 

We have to compute for the grand total amount, however, the data contains two different currencies

 

wvefwfcssddvs.JPG

 

we have a list of values to convert USD to PHP (exchange_rate_id is 1) but we need to capture the latest conversion per month

 

changerates.JPG

 

can I ask for help for the formula. Thank you.

1 ACCEPTED SOLUTION

Hi @sclencioco

 

You may add a month column for your rate table. Then link the Rate table with the Amount Table in relationship view. Then you may create a measure such as:

Convert =
CALCULATE (
    SUM ( Amount[Amount] ) * MAX ( Rates[LatestRate] ),
    FILTER ( ALL ( Amount ), Amount[Month] = MAX ( Amount[Month] ) )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @sclencioco

 

You may get the latest conversion per month by below calculated column or measure:

 

LatestRate =
VAR RankForDate =
    RANKX (
        FILTER (
            Rates,
            YEAR ( Rates[covered_date] ) = YEAR ( EARLIER ( Rates[covered_date] ) )
                && MONTH ( Rates[covered_date] ) = MONTH ( EARLIER ( Rates[covered_date] ) )
        ),
        Rates[covered_date],
        ,
        DESC,
        DENSE
    )
RETURN
    IF ( Rates[exchange_rate_id] = 1 && RankForDate = 1, Rates[rate] )

1.png

 

Measure =
VAR RankForDate =
RANKX (
FILTER (
ALL ( Rates ),
YEAR ( Rates[covered_date] ) = YEAR ( MAX ( Rates[covered_date] ) )
&& MONTH ( Rates[covered_date] ) = MONTH ( MAX ( Rates[covered_date] ) )
),
CALCULATE ( MAX ( Rates[covered_date] ) ),
,
DESC,
DENSE
)
RETURN
IF (
MAX ( Rates[exchange_rate_id] ) = 1
&& RankForDate = 1,
MAX ( Rates[rate] )
)

 

Regards,

Cherie

 

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello,

 

I was able to get the latest per month, however, how can I get the converted amount in PHP?

NO1.JPG

 

here's the table of conversion

NO2.JPG

 

 

 

Below is sample amount (in USD) to be converted to PHP

 

NO3.JPG

 

Hi @sclencioco

 

You may add a month column for your rate table. Then link the Rate table with the Amount Table in relationship view. Then you may create a measure such as:

Convert =
CALCULATE (
    SUM ( Amount[Amount] ) * MAX ( Rates[LatestRate] ),
    FILTER ( ALL ( Amount ), Amount[Month] = MAX ( Amount[Month] ) )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, there are multiple solutions to the currency conversion problem online, but none seem to get the sumtotal right, including this solution. Do you know how to solve it? I suppose it would contain some combinations of IF(hasonevalue()) and sumx.

Hello,

 

I Experienced this error when I try to create relationship

 

relationship.JPG

Hi @sclencioco

 

It seems you need to update the version. Then set the relationship. Here is the sample file for your reference.

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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