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.
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:
Is there any way to not consider this calculation group for some measures?
Thanks!
Solved! Go to Solution.
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.
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.
@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
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.
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. 👊
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
99 | |
76 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |