Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
THEG72
Helper V
Helper V

Performance Analyser shows slow DAX query in New file but fast in Original File?

Hi PBI Community,

I am trying to figure out why my DAX query is really slow when i have replicated my solution into a new file?

 

Fast VersionFast Version

Here is the output from the performance analyser for the fast version

// DAX Query Speed 6154 FAST
DEFINE
  VAR __DS0FilterTable = 
    TREATAS({"2019"}, '+ C A L E N D A R'[Fiscal Year])

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'Income Statement Template'[Row Index],
      'Income Statement Template'[Income Statement Items],
      __DS0FilterTable,
      "Selected_Year_Actuals", 'Income Analysis'[Selected Year Actuals],
      "Selected_Year_Previous_Actuals", 'Income Analysis'[Selected Year Previous Actuals],
      "TY_vs_PY_Actuals", 'Income Analysis'[TY vs PY Actuals],
      "TY_vs_PY_Actuals__", 'Income Analysis'[TY vs PY Actuals %]
    )

  VAR __DS0PrimaryShowAll = 
    ADDMISSINGITEMS(
      'Income Statement Template'[Row Index],
      'Income Statement Template'[Income Statement Items],
      __DS0Core,
      'Income Statement Template'[Row Index],
      'Income Statement Template'[Income Statement Items],
      __DS0FilterTable
    )

EVALUATE
  GROUPBY(
    __DS0PrimaryShowAll,
    "MinTY_vs_PY_Actuals__", MINX(CURRENTGROUP(), [TY_vs_PY_Actuals__]),
    "MaxTY_vs_PY_Actuals__", MAXX(CURRENTGROUP(), [TY_vs_PY_Actuals__])
  )

EVALUATE
  TOPN(
    501,
    __DS0PrimaryShowAll,
    'Income Statement Template'[Row Index],
    1,
    'Income Statement Template'[Income Statement Items],
    1
  )

ORDER BY
  'Income Statement Template'[Row Index],
  'Income Statement Template'[Income Statement Items]

 

Here is the same Visual in a new file and the output of the performance is a lot slower

 

Slow DAX performanceSlow DAX performance

Here is the output from the Performance Analyser

 

// DAX Query Speed is 24915 SLOW
DEFINE
  VAR __DS0FilterTable = 
    TREATAS({"2019"}, 'Calendar'[Fiscal Year])

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      'Income Statement Template'[Row Index],
      'Income Statement Template'[Income Statement Items],
      __DS0FilterTable,
      "Selected_Year_Actuals", 'Performance Analysis'[Selected Year Actuals],
      "Selected_Year_Previous_Acutals", 'Performance Analysis'[Selected Year Previous Acutals],
      "TY_vs_PY_Actuals", 'Performance Analysis'[TY vs PY Actuals],
      "TY_V_PY_Actuals__", 'Performance Analysis'[TY V PY Actuals %]
    )

EVALUATE
  TOPN(
    501,
    ADDMISSINGITEMS(
      'Income Statement Template'[Row Index],
      'Income Statement Template'[Income Statement Items],
      __DS0Core,
      'Income Statement Template'[Row Index],
      'Income Statement Template'[Income Statement Items],
      __DS0FilterTable
    ),
    'Income Statement Template'[Row Index],
    1,
    'Income Statement Template'[Income Statement Items],
    1
  )

ORDER BY
  'Income Statement Template'[Row Index],
  'Income Statement Template'[Income Statement Items]

In the slow version, I can see that the Evaluate TOPN function seems to be running a lot earlier than the fast version.

Can anyone advise why this is the case and what I can do to improve the speed to how the original is running?


Its got me stumped?

 

 

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@THEG72 

 

You may check if it is affected by the data model size.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft 

Its a smaller data model. Does the query information supplied give any indications...and the queries look different too when extracted from the performance analyser

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.