Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I am struggling to understand how to calculate a running total. I have a columns with customer IDs, week numbers and a number of sessions per week. I would like to calculate a running total of the number of sessions per customer.
What I've done so far is
RT Sessions = CALCULATE(sum(Query1[Sessions]),filter(all(Query1[concat sessions]),Query1[concat sessions]<=MAX(Query1[concat sessions])))
Sessions is the count of sessions per week. Concat sessions is the week numbers. As it is, it's just giving me the number of sessions each week, but I need this to be running total.
Sorry, I am very new to DAX and Power BI.
I am really sorry, but I am still struggling to understand the code for Running Total. I have tried several YouTube videos and code but none of it works. In the following example, can you please tell me, what is the correct code to calculate the running total of Sessions per ID?
@tpoltorak , Try like
RT Sessions = CALCULATE(sum(Query1[Sessions]),filter(all(Query1) ,Query1[concat sessions]<=MAX(Query1[concat sessions]) && Query1[customer] =max(Query1[customer] )))
When you are saying Query1[customer] do you mean customer ID's? Then selecting a max customer ID doesn't make sense in my head. Sorry. 🙂
@tpoltorak , Yes. I was not sure about the column name. I want that work within the same customer ID
So, wouldn't the line
Query1[customerID] =max(Query1[customerID]
attempt to select the maximum customer ID?
@tpoltorak , If you will use customer ID in visual for running total inside a customer, it will take customer from the context.
@tpoltorak , refer this
https://blog.crossjoin.co.uk/2020/01/20/visual-has-exceeded-the-available-resources-error-power-bi/
also, Please share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
This is a sample of data where RT sessions is the desired result
concat sessions Account Sessions RT Sessions
202050 A001 1 1
202051 A001 4 5
202052 A001 2 7
202101 A001 6 13
202102 A001 1 14
202050 A002 1 1
202051 A002 0 1
202052 A002 0 1
202101 A002 0 1
202102 A002 0 1
Thank you so much for helping me.
Hope this measure is what you want
User | Count |
---|---|
22 | |
14 | |
11 | |
7 | |
5 |
User | Count |
---|---|
24 | |
22 | |
20 | |
15 | |
10 |