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.
So I have a dataset of 4.6million rows containing insurance rates for various quotes and their respective insurance company. I have managed to calculate a rank function that ranks each company's rates for each quote (KEY) and average it, keeping in mind filters made on the company name. It looks as follows:
Rank: AVERAGEX(VALUES('Test'[KEY]),RANKX( FILTER(ALLSELECTED('Test'[Company]),[AvgRate]),[AvgRate],,ASC))
AvgRate: AVERAGE('Test'[Rate])
However the rank measure takes really long to calculate to calculate. Looking into its timings in DAX Studio, it takes 39,161ms to run. Can anyone suggest an alternate way to structure my measure such that it takes less time?
Hi @Anonymous ,
You could use VAR() to save the result of an expression as a named variable.
rank =
VAR a =
VALUES ( 'Test'[KEY] )
VAR b =
FILTER ( ALLSELECTED ( 'Test'[Company] ), [AvgRate] )
RETURN
AVERAGEX ( a, RANKX ( b, [AvgRate],, ASC ) )
And you could refer to this video to learn how to optimize your dax.
@v-eachen-msft Thanks for the suggestion however it took even longer in DAX Studio to as the total time to just calculate this measure was 63,723ms
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 | |
85 | |
66 | |
51 | |
45 |
User | Count |
---|---|
216 | |
89 | |
82 | |
66 | |
57 |