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

Performance of FIRSTDATE/FIRSTNONBLANK with additional conditions

I am experiencing serious performance issues with a report that uses the following type of DAX formulae:

CALCULATE(
FIRSTDATE(event_table_datetime_column);
event_table_location_code_clumn IN (value1; value2);
event_table_event_code_column IN (value3; value4)
)

to compute key events for each item. There are several millions of items and about 20 events for each item. The event table consists of the item_id, the event datetime, the location code and the creator code. The datetime is expressed with the accuracy of a second.

In practice I can run the report on a few hundred thousand items only, otherwise I run out of memory. Calculating with 150 000 items it takes 4 GB of memory (when looking at the Task Manager).

I know the number one thing to do with datetime columns is to break them into date and time. Since calculations are performed for each item, I don't see this being a solution here. I guess it would be possible: finding a first datetime would then include finding the first date and then finding the first time with the extra condition on the event date matching the one that was found to be the first.

I also tried using

SUMMARIZE (event_table;
item_id;
CALCULATE(FIRSTDATE(event_table_datetime_column);
column1=true() & column2=true()))


where column1 and column2 are calculated columns in the event table with the same conditions as in the first version, that is event_table_location_code_clumn IN (value1; value2) and event_table_event_code_column IN (value3; value4). The memory usage of this version looks exactly the same as for the first version.

 

The logical guess is that in both cases the event table is being materialized to produce the result. How could I possibly avoid this? Any suggestions or ideas as to what I should try?

 

I can't share the file publically, but if someone would offer to help out, you could have a look.

3 REPLIES 3
Anonymous
Not applicable

Not really. I have read the suggestions for performance tuning, I have made my way through "The definitive guide to DAX" and so on. I am seeing some improvement, but I'm not there yet. 

What I have noticed is that it's better to do this:
"Find the last event for this item that happened before (find the first event for this item that happened in a specific location"
rather than doing this:
temp="Find the first event for this item that happened in a specific location"
and then pass that to a second calculation as
"Find the last event for this item that happened before temp"

v-danhe-msft
Employee
Employee

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Employee
Employee

Hi @Anonymous,

Based on my research, you could refer to below link to build fast and reliable reports in Power BI.

https://docs.microsoft.com/en-us/power-bi/power-bi-reports-performance

 

Regards,

Daniel He

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

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.