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
KH11NDR
Helper IV
Helper IV

Running total, by Project ID column

Hi Guys

 

I Need the running totals each month in a column for the Days column grouped by Project ID.

 

Thanks Guys

 

Project IDDaysDateRunning Total Days
AA1601/01/201816
AA2001/02/201836
AA2001/03/201856
AA2001/04/201876
BB101/01/20181
BB101/02/20182
BB601/03/20188
BB701/04/201815
1 ACCEPTED SOLUTION
Stachu
Community Champion
Community Champion

they do work for me - is the Table[Date] of data type Date? Other than that I cannot think of other reason for it not to work
Capture.PNGCapture2.PNG



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

View solution in original post

10 REPLIES 10
Stachu
Community Champion
Community Champion

syntax for calculated column

Running Total Days = 
VAR Project = 'Table'[Project ID]
VAR CurrentDate = 'Table'[Date]
RETURN
CALCULATE(SUM('Table'[Days]),FILTER('Table','Table'[Project ID]=Project &&'Table'[Date]<=CurrentDate))

syntax for a measure - summary for a project gives the sum for the latest date for that project

Running Total Days Measure = 
VAR Project = SELECTEDVALUE('Table'[Project ID])
VAR CurrentDate = MAX('Table'[Date])
RETURN
CALCULATE(SUM('Table'[Days]),'Table'[Project ID]=Project,'Table'[Date]<=CurrentDate)


Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Stachu.

 

None of those worked, In the measure, it gives me the same days as they are in each month, no rolling totals.

Stachu
Community Champion
Community Champion

they do work for me - is the Table[Date] of data type Date? Other than that I cannot think of other reason for it not to work
Capture.PNGCapture2.PNG



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

@Stachu

 

I've got it working, I've got a further filter, which divides the data by three, If I filter on it manually and divide your column y 3, I get exactly what I'm looking for.

 

Is there obviously a way to filter on two columns?

Stachu
Community Champion
Community Champion

I don't get the question.
in the syntax I posted there is filter on Table[Project ID] & Table[Date], so 2 columns are filtered with AND operator, you can add more columns in the same manner



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

@Stachu 

 

Ignore the last question, I'ts working stop on, thanks.

 

Column Date is Date Type

 

Ok, Maybe because in my real data model it's grouped by Product ID and another column called "ReportingDate".  

Stachu
Community Champion
Community Champion

Is ReportingDate coming from the same table, or from other table connected via join?
If the latter is the case then all Table[Date] syntax should be replaced with TableName[ReportingDate]



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Zubair_Muhammad
Community Champion
Community Champion

@KH11NDR

 

Column =
CALCULATE (
    SUM ( [Days] ),
    FILTER (
        ALLEXCEPT ( Table1, Table1[Project ID] ),
        [Date] <= EARLIER ( [Date] )
    )
)

Regards
Zubair

Please try my custom visuals

No that never worked, That's what I tried myself first.

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.