cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

Is this function written poorly?

Good afternoon,

 

I utilize the following DAX measure often. I am curious if this formula, from the naked eye, looks poorly written (poor performance) or if it looks fine given the information provided?

 

The data measure is crunching over 30,000 records.  If this question is not appropriate, or enough information given the question, please let me know and I will disregard.  Thank you.

 

12M T.R. Middle k ProductX :=
PRODUCTX (
    VALUES ( PrimaryDateID[PrimaryDateID] ),
    (
        1
            + (
                CALCULATE (
                    AVERAGE ( Performance[Month_3_Fwd_Blend_TR_then_PR_Ver_1#1] ),
                    FILTER (
                        Sheet1,
                        Sheet1[Total Return:Y-1]
                            >= PERCENTILE.INC ( Sheet1[Total Return:Y-1], MIN ( Quantile[Min_Value] ) )
                            && Sheet1[Total Return:Y-1]
                                <= PERCENTILE.INC ( Sheet1[Total Return:Y-1], MAX ( Quantile[Max_Value] ) )
                    )
                )
            )
                / 100
    )
)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Is this function written poorly?

Hi @Jkaelin,

 

What is your actually problem with above DAX formula? What did you mean "looks poorly written (poor performance)"?

 

For its format, it looks tidy and clear. For its performance, it looks like not a complex logic. Acording to current information, this function look fine. Whether it is the best appropriate method, it depends on your detailed data in actual environment.

 

Here are some articles written about optimizing DAX performance:

Tune your PowerPivot DAX query, don’t use the entire table in a FILTER and replace SUMX if possible

DAX Best Practices

Optimize DAX expressions involving multiple measures

 

Best regards,
Yuliana Gu

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

View solution in original post

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Re: Is this function written poorly?

Hi @Jkaelin,

 

What is your actually problem with above DAX formula? What did you mean "looks poorly written (poor performance)"?

 

For its format, it looks tidy and clear. For its performance, it looks like not a complex logic. Acording to current information, this function look fine. Whether it is the best appropriate method, it depends on your detailed data in actual environment.

 

Here are some articles written about optimizing DAX performance:

Tune your PowerPivot DAX query, don’t use the entire table in a FILTER and replace SUMX if possible

DAX Best Practices

Optimize DAX expressions involving multiple measures

 

Best regards,
Yuliana Gu

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

View solution in original post

Highlighted
Resolver I
Resolver I

Re: Is this function written poorly?

@v-yulgu-msft

 

Thank you very much for the response.  I will read those articles.  I appreciate the feedback.  

 

What did you mean "poor performance"?

I use this measure in a Power Pivot table for quarterly periods from 2000-2017 (about 60 periods) and the time it takes to calculate is about 20 seconds.  If I use a derivative of that function to generate Stdev & Counts.  It takes a little bit longer.

 

Thank you,

James k

Highlighted
Microsoft
Microsoft

Re: Is this function written poorly?

Hi @Jkaelin,

 

Sometimes the long response time might also be related to the large amount of data.

 

Regards,
Yuliana Gu

 

 

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

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors