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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
emarc1
Advocate II
Advocate II

Optimisation of measure (count when more than 1 row)

 

I have a measure that displays the name of a product if there's just one value and displays the count of items if there's more than one:

 

IF(
    COUNT( Orders[Ordered Item] ) <=1,
    VALUES( Orders[Ordered Item] ),
    COUNT( Orders[Ordered Item] ) & " Items"
)

 

So if there are several items with the same order number, it just tells you how many but if there's just one, you see the full name.

 

Capture.PNG

 

Which is useful when you want to drill to the order line level:


Capture2.PNG

 

The issue is that I run into performance issues with more rows. At the line level and a weeks selected, it slows down and if I select a month, it runs out of memory.

 

Is there a more optimised way of doing this?

 

Previously it would just show the first line only and that was fast, but it can be confusing for end users when there's more than one item.

 

2 REPLIES 2
emarc1
Advocate II
Advocate II

Additional thoughts:

 

Shouldn't it only do this measure for the rows at the top of the matrix and then load more only once the user scrolls further down? Why does it need more memory for more rows if they're not going to all get loaded anyway?

Here's the data model that's been behaving lately:

 

Capture.PNG

 

 

I was filtering my table with a customer code held in the 'Customers (Orders)' table. Using the same code from within the 'Orders' table makes the matrix perform much better! Rather than running out of memory, the matrix renders in about a second! (The customer name field is in the 'Customers (Orders)' though so if I needed that I guess I'd need to use the query editor and bring it into the 'Orders' table.)

 

Capture2.PNG

 

Can someone explain why one simple relationship is causing these issues though?

 

I've been trying to work out what is causing the issue with DAX Studio but I've not used it before so I'm not sure if this is correct:

 

Capture.PNG

 

Strangely, if I change the customer code column here between Orders[CUSN] and 'Customers (Orders)'[CUSN20], it only makes a 3-4% difference in FE time.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.