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
dnewton
Helper II
Helper II

Events in progress - working but has become very slow

Hi All,

 

I have a calculated column for a software application which counts how many sessions are "concurrent" with another session (in other words 'events in progress'). As below:

Concurrent with this session = 
COUNTROWS (
    FILTER (
        Sessions,
        Sessions[Id] <> EARLIER(Sessions[Id])
            && NOT (Sessions[End] < EARLIER(Sessions[Start] ) || Sessions[Start] > EARLIER(Sessions[End]) )
    )
) +1

This has worked fine for several months but recently as the size of my database has grown to around 5,000 rows it is now taking a very long time to update and is timing out in the Power Bi Service causing the dataset to not refresh.

 

Is there a way I can "optimise" this to improve performance? 

 

I found another suggestion elsewhere (as below) but have had no luck translating this for my data:

=Calculate(
CountRows(FactInternetSales),
Filter(Values(FactInternetSales[OrderDateKey]), Min(DimDate[DateKey])>=[OrderDateKey]),
Filter(Values(FactInternetSales[ShipDateKey]), Max(DimDate[DateKey])<=[ShipDateKey]))

 

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @dnewton 

If you may try this formula as below:

Concurrent with this session = 
var _Id=Sessions[Id]
var _Start=Sessions[Start]
var _End=Sessions[End]
Return
COUNTROWS (
    FILTER (
        Sessions,
        Sessions[Id] <> _Id
            && NOT (Sessions[End] < _Start || Sessions[Start] > _End )
    )
) +1

or

Concurrent with this session = 
var _Id=Sessions[Id]
var _Start=Sessions[Start]
var _End=Sessions[End]
Return
COUNTROWS (
    FILTER (
        Sessions,
        Sessions[Id] <> _Id
            &&  (Sessions[End] >= _Start && Sessions[Start] <= _End )
    )
) +1

 

Regards,

Lin

Community Support Team _ Lin
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
v-lili6-msft
Community Support
Community Support

hi  @dnewton 

If you may try this formula as below:

Concurrent with this session = 
var _Id=Sessions[Id]
var _Start=Sessions[Start]
var _End=Sessions[End]
Return
COUNTROWS (
    FILTER (
        Sessions,
        Sessions[Id] <> _Id
            && NOT (Sessions[End] < _Start || Sessions[Start] > _End )
    )
) +1

or

Concurrent with this session = 
var _Id=Sessions[Id]
var _Start=Sessions[Start]
var _End=Sessions[End]
Return
COUNTROWS (
    FILTER (
        Sessions,
        Sessions[Id] <> _Id
            &&  (Sessions[End] >= _Start && Sessions[Start] <= _End )
    )
) +1

 

Regards,

Lin

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

This worked flawlessly - thank you!

Greg_Deckler
Super User
Super User

Maybe something in this series of articles will help: https://community.powerbi.com/t5/Community-Blog/Performance-Tuning-DAX-Part-1/ba-p/976275


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.