Skip to main content
Microsoft Idea

Power BI

New

Optimize COLUMNSTATISTICS

Vote (1) Share
Kenneth Barber's profile image

Kenneth Barber on 23 May 2023 01:53:36

COLUMNSTATISTICS is a useful but slow function. To make it calculate faster, consider calculating only the portion of it that is used in the DAX expression from which it is called. For example, if I use SELECTCOLUMNS(COLUMNSTATISTICS(),[Table Name]), then only the Table Name column should be calculated. If I use FILTER(COLUMNSTATISTICS(),[Table Name]="Table1"), then the statistics columns of COLUMNSTATISTICS should be calculated only for the columns of Table1. This is in contrast to calculating all of COLUMNSTATISTICS and then filtering the result to show only the rows for Table1.