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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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