Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I am doing some averaging computations, and my computations seems to be quite off. I just want to ask for correction on why my measure doesnt seem to work. My data are as follows :
On my Masterlist table:
Borrower Attribute Date Value
ABC Loan 1/1/2019 1000
ABC Collection 1/5/2019 300
ABC Loan 2/5/2019 3000
My measures were as follows :
Solved! Go to Solution.
Hi, @jmcph , the cause of problem lies in leveraging a variable within iteration.
In fact, variable in DAX is NOT always variable, refer to:
https://radacad.com/caution-when-using-variables-in-dax-and-power-bi
In DAX, variables are calculated within the scope in which they are written, and then the result of them is stored and used in the rest of the expression.
To be more precise with your issue, when AVERAGEX iterates All( 'Calendar'[Date]) (being "1/1", "1/5", "2/5"), SumLoan is used 3 times with the same value, which is calculated on iterating "1/1". Furthermore, SumLoan is define in the outmost scope of the measure, only initial filter context instead of "1/1", such as slicer, row/column of viz etc., is used in the calculation.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi, @jmcph , the cause of problem lies in leveraging a variable within iteration.
In fact, variable in DAX is NOT always variable, refer to:
https://radacad.com/caution-when-using-variables-in-dax-and-power-bi
In DAX, variables are calculated within the scope in which they are written, and then the result of them is stored and used in the rest of the expression.
To be more precise with your issue, when AVERAGEX iterates All( 'Calendar'[Date]) (being "1/1", "1/5", "2/5"), SumLoan is used 3 times with the same value, which is calculated on iterating "1/1". Furthermore, SumLoan is define in the outmost scope of the measure, only initial filter context instead of "1/1", such as slicer, row/column of viz etc., is used in the calculation.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Proud to be a Super User!
Yeah. Thanks for the input. I think i'll do normal average calculation first, then make another measure filtering the dates to make it simpler. I appreciate it thanks!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
143 | |
75 | |
62 | |
51 | |
47 |
User | Count |
---|---|
211 | |
83 | |
64 | |
60 | |
56 |