Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet 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
Hello,
link to the pbix
I cannot get the sum of this measure over "uniqueID".
The measure is a bit complex, I tried to trim down the attached pbix to the very essential issue.
Basically, I have a measure which depends on 2 context (time_1min, and uniqueID).
I cannot sum over UniqueID... I honestly don't understand why it does not work as is.
I tried
CALCULATE(
SUMX(
CALCULATETABLE(
VALUES(KIX_AODB_data[UniqueID]),
REMOVEFILTERS(Time_flight)
),
_result_by_flight // measure displayed on screenshot above
)
)
Seems simple but is actually quite complex I guess
Here is the data model (dead simple).
Solved! Go to Solution.
@AntoineGlacet
You have several variables in that piece of code, and variables that in turn use other variables. Drop the variables for now. Use either the explicit code or a measure. Make sure every piece is evaluated where it needs to be. Once it works, you can go back to, carefully, simplifying with variables.
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
I haven't looked in detail but first thing that stands out is that you are using a variable (_result_by_flight) as second argument to the SUMX. Not that variables in DAX are immutable, i.e. their values does NOT change at all after being created. That means row context in your SUMX will NOT have any affect and the result of the SUMX will be the precalculated value of _result_by_flight times the number of rows of the table in SUMX's argument.
I am guessing that is not what you want
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Hi @AlB ,
I think it is clearly an issue of variable evaluation and context.
When I copy pasted the whole variable definition instead of its variable name, I have the same result...
How can I make sure the variable is evaluated in the proper context?
@AntoineGlacet
You have several variables in that piece of code, and variables that in turn use other variables. Drop the variables for now. Use either the explicit code or a measure. Make sure every piece is evaluated where it needs to be. Once it works, you can go back to, carefully, simplifying with variables.
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
86 | |
85 | |
66 | |
49 |
User | Count |
---|---|
140 | |
113 | |
104 | |
64 | |
60 |