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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Jayshamone
Helper I
Helper I

DAX Article Distribution

Hello,

I am trying to calculate the distribution of articles (or article groups) in a dynamic timespan.

Currently I am using a DAX Statement which underperforms massively with a large number of articles or dates:

Calculate(distinctount('Dim Shops'[Shop]); filter('Fakt Transactions'; 'Fact Transactions'[Amount] > 0))

The statement returns the correct value, however the runtime can easily exceed 1 Minute or more.
Does anybody have an idea how to boost performance on such statements?

Thank you
Justus

1 ACCEPTED SOLUTION
Jayshamone
Helper I
Helper I

Thanks for your help.
However, I found a formula that calculates the correct result in far less time.
It goes like this:

CALCULATE (DISTINCTCOUNT('Dim Shops'[Shop]); VALUES([Fact Transactions]))

View solution in original post

5 REPLIES 5
Jayshamone
Helper I
Helper I

Thanks for your help.
However, I found a formula that calculates the correct result in far less time.
It goes like this:

CALCULATE (DISTINCTCOUNT('Dim Shops'[Shop]); VALUES([Fact Transactions]))

v-lionel-msft
Community Support
Community Support

Hi @Jayshamone ,

 

This formula is not complicated, it seems that there is no room for improvement.

The following reasons may cause the query to be too slow:

1. The dataset is too large.

2. Connection mode.

What's your connection mode?

The time that's needed to refresh the visualization depends on the performance of the underlying data source if you are using 'DirectQuery'.

3. The local computer configuration is too low.

 

Best regards,
Lionel Chen

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ThoSch-Ger
Helper I
Helper I

Hi,

 

how large is your table?

And how does the Dim Shops table relate to the Fact Transaction table?

 

Have you tried it without Filter?

 

Calculate ( distinctount('Dim Shops'[Shop]); Fact Transactions'[Amount] > 0 )

 

 

The Transactions Table has about 60 Mio entries, The Trans_Aggregate Table which relates to the Shops Table has about 20 Mio Entries. 

The formula returns a false - every article has the same distribution then - value without filter. This does not work unfortunately

Helpful resources

Announcements
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.