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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Performance Issue with measures

Hi ,

I am having performace issue using these measures. any help in Optimizing this is greatly appreciated!

 

I am using these measures to satisfy certain criteria

/* Measure to satisfy the If condition below */

Measure 1 =
Var _Length =selectedvalue('Sheet1 (2)'[Length]) return If(_Length>5,1,2)
=================================== /* measure to count the occurrence of 1 in the above measure*/ Measure 2 =
countrows(filter('Sheet1 (2)','Sheet1 (2)'[Measure 1]=1))
================================== /* Measure to get the percent of occurrence of 1 ) Measure 3 =
Countrows(Filter('Sheet1 (2)','Sheet1 (2)'[Measure 2]=1))/Countrows(FILTER('Sheet1 (2)','Sheet1 (2)'

[Measure 2](All('Sheet1 (2)'))))

Or
Measure 3 = [Measure 2]/Countrows(FILTER('Sheet1 (2)','Sheet1 (2)'
[Measure 2](All('Sheet1 (2)'))))

I am using these similar formula for all the columns in a table. ( having 10 columns)

I also tried using the Measure 3 in different ways but performace is still the same. Looks like the  Filter function is causing the report to slow down since I am using it in 10 diffrent formula for each of my columns.

 

Any other way which can help increase the performace issue ??

 

Thanks

Tejaswi

 

 

3 REPLIES 3
TomMartens
Super User
Super User

Hey,

 

I'm sure I do not really understand what your requirement is, but nevertheless I created something 🙂

 

My table looks like this

image.png

I also created an unrelated table that I use to provide items for a slicer using this DAX statement:

Slicer Values = 
GENERATESERIES(1 , MAX('Table1'[Length]) , 1) 

Then I created this measure that counts the rows in my table with a length greater than the selection from the slicer:

no of rows (length) = 
var _Length =selectedvalue('Slicer Values'[Value])
return
SUMX(
    'Table1'
    , IF('Table1'[Length] > _Length , 1 , BLANK())
)

and this measure to calculate the percentage:

no of rows (length) percentage = 
DIVIDE([no of rows (length)] , COUNTROWS('Table1'))

All the above allows me to create a report that looks like this:

image.png

Maybe this will provide some ideas to solve your requirement, if not you may consider to create a Power BI file that contains some sample data, upload the file (also the excel file if you use excel to create the sample data) to onedrive or dropbox and share the link.

 

Regards,

Tom

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

HI @TomMartens ,

Thanks for your reply!

 

My table is somewhat like this:

DOC IDGroup TypeWeight
1442236SERVICABCD534.77
1444364SERVICABCD0.55
1444640SERVICABCD0.204
1445079SERVICABCD1.633
1449308SERVICABCD1
1451398SERVICABCD4
1453189KITASYABCD1
1453193ASYABCD1
1453194ASYABCD1
1453203ASYABCD1
1453204ASYABCD1

 

Now I add my measures to this table : ( I have this measure based on some conditions if it meets the condition for Group column then it return 1 in measure. SImilarly if it meets the condition for Type column it will return 1 in measure column next to it and similar for the weight field.)

DOC IDGroup Measure 1 for GroupTypeSimilar Measure 1 for Type WeightSimilar Measure 1 for Weight
1442236SERVIC1ABCD1534.771
1444364SERVIC1ABCD10.551
1444640SERVIC1ABCD10.2041
1445079SERVIC1ABCD21.6332
1449308SERVIC1ABCD212
1451398SERVIC1ABCD242
1453189ASY2ABCD212
1453193ASY2ABCD212
1453194ASY2ABCD211
1453203ASY2ABCD211
1453204ASY2ABCD112

 

Now I want to  show the count of occurence of 1s in my each column ( as shown above_)

(for this I am using  Measure 2 in the original post)

For Example Measure:

Measure 1 for GroupSimilar Measure 1 for Type Similar Measure 1 for Weight
occurrence of 1 = 645

 

and then I used this above count in my Measure 3 to get the percentage.

 

I hope I am making this clear.

 

Thanks,

Tejaswi

 

 

MFelix
Super User
Super User

Hi @Anonymous ,

 

Check the link below with some explanations on how to improve and use the filters.

 

https://www.sqlbi.com/articles/optimizing-dax-expressions-involving-multiple-measures/

https://www.sqlbi.com/articles/managing-all-functions-in-dax-all-allselected-allnoblankrow-allexcept/

https://www.youtube.com/watch?v=B-h3Pohtn1Y

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.