cancel
Showing results for
Did you mean:
Helper I

## Calculation Group to convert currency - How ignore for measures that are not currency?

Hi all,

I created a simple calculation group to convert my currency from USD to EUR.

It is a simple query:

The problem is that I don't want to apply this calculation group to quantity, just to currency measures.

I tried to use REMOVEFILTERS, but it didn't work:

CALCULATE(
SUM(factTable[Qty]),
REMOVEFILTERS('CalculationGroup'[Convertion])
)

Is there any way to not consider this calculation group for some measures?

Thanks!

1 ACCEPTED SOLUTION
Resident Rockstar

You need to consider the filter context.

When you apply the calculation group:

``````SUMX(
factTable;
SELECTEDMEASURE() * 0,9
)``````

which evaluates to

``````SUMX(
factTable;
AVERAGEX(
VALUES('Calendar'[Date]);
[Sum Total]
) * 0,9
)``````

SUMX iterates over factTable, and for each row it calculates the average of that row. And the average of a single row is the same as the value of that row. So with this calculation group, both [Avg/Day] and [Sum Total] returns the same value.

I can't see any reason why you could not replace the current calculation group

``````=SUMX(
factTable;
SELECTEDMEASURE() * 0,9
)``````

with

``=SELECTEDMEASURE() * 0,9``

And with the latter you will get the correct values with both measures.

4 REPLIES 4
Resident Rockstar

Hi,

have you tried using SELECTEDMEASURENAME() combined with an if-statement?

``````=
IF (
SELECTEDMEASURENAME () = "some measure",
SELECTEDMEASURE (),
SUMX ( facttable, SELECTEDMEASURE () * 0.9 )
)``````

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

Helper I

@sturlawsyour solution worked fine, but I ran into another problem.

I have a measure that calculates the average per day, but when I apply the calculation group, the result is not correct. Instead of bringing me the converted average value, this brings me the converted value of the measure [Sum Total].

Measures:

Whitout applying calculation group:

Applying calcution group:

Do you know how I can get around this?

I am attaching the sample file in this link: https://1drv.ms/u/s!At5JlMR_naI1gf4zcSKNi8b27E6Evg?e=eJcULs

Resident Rockstar

You need to consider the filter context.

When you apply the calculation group:

``````SUMX(
factTable;
SELECTEDMEASURE() * 0,9
)``````

which evaluates to

``````SUMX(
factTable;
AVERAGEX(
VALUES('Calendar'[Date]);
[Sum Total]
) * 0,9
)``````

SUMX iterates over factTable, and for each row it calculates the average of that row. And the average of a single row is the same as the value of that row. So with this calculation group, both [Avg/Day] and [Sum Total] returns the same value.

I can't see any reason why you could not replace the current calculation group

``````=SUMX(
factTable;
SELECTEDMEASURE() * 0,9
)``````

with

``=SELECTEDMEASURE() * 0,9``

And with the latter you will get the correct values with both measures.

Helper I

Hey @sturlaws you are right, I made this change in the calculation group and it worked as expected.

Thank you very much for your attention and explanation on this topic. It helped me clarify things a little more. 👊

Announcements