cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Helper III

## Calculate YTD values with different exchange rates per month

Hi,

I would like to calculate the ytd value for the following tables under consideration of the different monthly Exchange rates:

Turnover

 Year month key Value 202201 1000 202202 2000

Exchange rates

 Year month key Rate 202201 1.1 202202 1.2

Reult shoud be:
1.1 * 1000 + 1.2 * 2.000

Is there a simple DAX solution which solves my problem with a measure?

BR

3 REPLIES 3
Super User

Hi lukmtb08. Considering you have a relationship between those tables and assuming the year month is unique column key for exchange rates, you can build something like this:

``````Sum value new rates =
SUMX(
Turnover,
Turnover[Value] * RELATED('Exchange rates'[keyRate])
)``````

Once you have the sumarization of the rates and values you can calculate YTD

``````YTD new rates =
CALCULATE(
[Sum value new rates]
, DATESYTD( CalendarTable[Date] )
)``````

That should make it work. If you have a different model than my assumption please show us more to help you.

I hope that helps,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

Helper III

Dear ibarrau, thank you very much! It works fine.

We do not have date fields as we report just monthly data. Therefore we have Reporting months (1-12).
Can we calculate the YTD value based on a slicer for the Reporting months.

Example.

Slicer = Month 10

-> YTD measure should calculate the values for 1-10

Is possibile to add a calculate expression?

Example:

Sum value new rates YTD =
Calculate(
SUMX(
Turnover,
Turnover[Value] * RELATED('Exchange rates'[keyRate])
),  Table[Month] <= Selectedvalue Table[Month])
)

Thanks you for your support! 🙂

Super User

Hi. You still can use YTD if you make changes on your model. Create a calendar table to use YTD. Then add a new column for the table with monthly value. Convert the period format 2022-05 to the first day of the month like 2022-05-01. Once you have that date you can relate it with the calendar like any date to use time intelligence measures.

I hope that make sense.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Happy to help!

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors