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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Anonymous
Not applicable

Using calculated column to find duration of app usage

Hi guys,

This question is based on a previous topic:

https://community.powerbi.com/t5/Desktop/Duration-of-usage-in-an-app/m-p/681482#M328233

I have been working with the calculated column that @TomMartens helped me with.
The problem is now, that I can not run the calculated column because of lack of memory (18 million rows).

I am wondering if there is any other way to create the "Duration" column?

This is the calculated column with slight changes from my previous post:

Tabel = ADDCOLUMNS(
    ADDCOLUMNS(
        SUMMARIZE(
            'FullExtract2017-2025'
            ;'FullExtract2017-2025'[AppId]
            ;'FullExtract2017-2025'[SessId]
            ;'FullExtract2017-2025'[EventTime - Start]
            ;'FullExtract2017-2025'[Feature_Key]
            ;'FullExtract2017-2025'[Country_Key]
            ;'FullExtract2017-2025'[UserInfo_Key]
            ;'FullExtract2017-2025'[SessionNumber_Key]
            ;'FullExtract2017-2025'[Module_Key]
        )
        ;"SessionEnd"; 
                var thisAppID = [Appid]
                var thisSessID = [SessId]
                var thisSessionStart = 'FullExtract2017-2025'[EventTime - Start]
                var theEnd = 
                    CALCULATE(
                        MIN('FullExtract2017-2025'[EventTime - Start])
                        ;ALL('FullExtract2017-2025'[Feature_Key])
                        ;FILTER(
                            'FullExtract2017-2025'
                            ;'FullExtract2017-2025'[AppId] = thisAppID && 'FullExtract2017-2025'[SessId] = thisSessID && 'FullExtract2017-2025'[EventTime - Start] > thisSessionStart
                        )
                    )
                return
                IF(ISBLANK(theEnd); thisSessionStart; theEnd)
                
    )
    ;"Duration";DATEDIFF('FullExtract2017-2025'[EventTime - Start];[SessionEnd];SECOND)
)


I am querying the data from an SQL database.

Please tell me if you need additional information.

Thank you!

1 ACCEPTED SOLUTION
ImkeF
Community Champion
Community Champion

Hi @Anonymous 

I've exerienced memory-problems with such a calculation as well. Using Power Query Group-function for "thisAppId" and "thisSessionId" could solve your case here:

https://www.thebiccountant.com/2018/09/30/memory-efficient-clustered-running-total-in-power-bi/

 

Please check if you can adapt it to your case, otherwise pls come back.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Community Champion
Community Champion

Hi @Anonymous 

I've exerienced memory-problems with such a calculation as well. Using Power Query Group-function for "thisAppId" and "thisSessionId" could solve your case here:

https://www.thebiccountant.com/2018/09/30/memory-efficient-clustered-running-total-in-power-bi/

 

Please check if you can adapt it to your case, otherwise pls come back.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Anonymous
Not applicable

This looks very interesting!

I will have a look - thank you so much

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors