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
Anonymous
Not applicable

Aggregation table distinctcount not working (when slicing via relation)

Hi everybody,

I have a problem regarding the filtering/slicing of aggregation tables.

 

I want to use aggregation tables for a dataset that is connected via DirectQuery to achieve performance gains.

This is my Datamodel (edited due to private data):
Data model.PNG

I have Table 1, which is related to Table 2 via the "Purchasing_Document_Number" column. There is a m:n connection between the tables. Table 1 is filtering Table 2. Both tables contain a Company_Code.

 

Following THIS GUIDE, I created aggregation tables that group by Purchasing_Document_Number and Company_Code in both tables. The aggregation tables are saved in "dual" mode (not DirectQuery) to optimize performance by caching data:
Aggregation.PNG

Using DaxStudio, i verified that the aggregated tables are indeed used for speeding up the performance.

 

Here is my problem:

I want to show the distinct amount of Purchasing_Document_Number filtered/sliced by the Company_Code of Table 1.

This worked flawlessly before adding the aggregation tables.

Now, i can only filter by the Company_Code of Table 2, PowerBI is crashing as soon as i try to filter by Company_Code of Table 1.

Using COUNT instead of DISTINCTCOUNT is still working.


Demo without error (COUNT):

Count.gif

 

Demo with error (DISTINCTCOUNT):

Distinctcount.gif

 

Is there a problem with my m:n relation? I tried relating the two tables directly via Company_Code, but this resulted in the same error.

 

Thanks in advance for your help!

 

 

1 REPLY 1
v-xulin-mstf
Community Support
Community Support

Hi @Anonymous,

 

Using many-to-many relationships directly is likely to cause problems, you can use a bridge table to connect those two tables and your life will be easier.

A common problem is circular dependency, you can refer:

https://www.sqlbi.com/articles/understanding-circular-dependencies/

If the issue still exists, you can provide the pbix file after removing sensitive information and I will check it for you.

 

Best Regards,

Link

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.