Last answered:

16 Dec 2022

Posted on:

16 Dec 2022

0

No real need for "TREATAS"

So, I think there is no real need for this function in here. I will share my thoughts and findings and I would love to hear a feedback to make sure I understood this function that has been ghosting me for a while. If you use:

Currency Conversion_2 =
IF(
    ISFILTERED(
        dimCurrency[CurrencyAlternateKey]
    ),
    SUM(
        factInternetSales[Sales Amount EUR]
    ) *
        CALCULATE(
            MAX(
                dimCurrency[Exchange Rate]
            ),
            VALUES(
                dimCurrency[CurrencyAlternateKey]
            )
        ),
    SUM(
        factInternetSales[Sales Amount EUR]
    )
)

This code works just fine, as VALUES returns whatever alternate key might have been filtered, which on its turn works as filter for CALCULATE. So, for example, if USD is selected, it will return USD as filter for CALCULATE and MAX will return the "maximum exchange rate" for USD (which of course is the only one there exist). This exchange rate is the number we need to multiply by the sales in EURO, which is not affected by the filtering selection, as factInternetSales is not connected to dimCurrency.

I'm kind of blind to be able to see any further, so if there is any observation to be made, I would love to hear back from anybody, the lecturer or any other student.

Many thanks,
Rafael

1 answers ( 0 marked as helpful)
Instructor
Posted on:

16 Dec 2022

0

Hi Rafael, we use TREATAS to make a virtual relationship between non-connected tables. There are many ways to achieve the end result, I don't see any issues with using the formula that you have shared, however this lesson is about TREATAS therefore it's purpose is to teach people how to use it, you might have business case scenario where you are required to use values from non-connected tables for whatever reason and knowing how to use TREATAS will definitely help.

Submit an answer