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

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
Super User
Super User

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
Super User
Super User

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
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.