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
joshcomputer1
Helper V
Helper V

cumulative total from a measure

Hi there,

 

I have an employee table named "masterall" and have start and end dates for each employee. I have a measure named "Employees Termed". This measure gets a count of employees that were termed for each month.  This measure works fine as is (see red columns below):

 

Employees Termed = calculate(countrows(masterall), masterall[title]<>"non-billable" && masterall[title]<>"bench", userelationship(DateTable1[Date], masterall[end date]))

 

**I have filtered out non-billable and bench employees from this count AND had to use an inactive date table relationship for this to work. 

 

Capture4.PNG

 

Now what I want to do is get that count and do a cumulative sum throughout the year so that I can show the a line chart that increases over the year (YTD is fine for this example).  

 

monthnum 1  2  3  4    5     6      7         8     9      10     11    12

sum            0  0  1  1    10  14    23      25    35     45     55    59

 

I tried adding a column named count with just 1's in it and then change the countrows in the formula to sum, but that did not work. Any help is appreciated. 

 

 

 

Here is a sample of the data on dropbox. 

https://www.dropbox.com/s/bj8eb3675aw2td0/PBI%20Forums%20Example.xlsx?dl=0

 

 

3 REPLIES 3
joshcomputer1
Helper V
Helper V

UPDATE:

I used a quick measure to get a YTD cumulative total. This is close, but it's not calculating the SUM right. It's less than it should be. Looking at the below graph.....July should show 7.5% +7.89% .  It shows 14.63%.

 

 

Capture6.PNG

 

Here are the calcs I am using. 

Bottom chart(this was generated by PBI) :

Termination Measure 3 running total in Date =
CALCULATE(
[Termination Measure 3],
FILTER(
ALLSELECTED('DateTable1'[Date]),
ISONORAFTER('DateTable1'[Date], MAX('DateTable1'[Date]), DESC)
)
)

 

Top chart:

Termination Measure 3 = [Termination Measure 2]/[Count of Active Employee]

 

 

Sums the termed employees that are not billable nor bench:

Termination Measure 2 = calculate(sum(MasterAll[count]), masterall[title]<>"non-billable" && masterall[title]<>"bench", userelationship(DateTable1[Date], masterall[end date]))

 

Counts of number of active employees during each month:

Count of Active Employee =
VAR endOfPeriod =MAX ( 'DateTable1'[Date] )
VAR startOfPeriod = MIN( 'DateTable1'[Date] )
RETURN
CALCULATE (
COUNTROWS ( MasterAll ),
FILTER (
ALLexcept(MasterAll, 'Key Teams'[Teams]),
MasterAll[Start Date] <= endOfPeriod
&& MasterAll[End Date] >= startOfPeriod
&& masterall[title]<>"non-billable"
&& masterall[title]<>"bench")
)

 

IF you have any idea why it is short, please let me know. 

Hi @joshcomputer1,

Have you resolved your issue? If you have, welcome to share your solution or mark the right reply as answer. More people will get useful information from here.

 

Thanks,
Angelia

Hi @joshcomputer1,

Please create a measure using the formula and check if it works fine. And do you mind share your .pbix file for further analysis? Do hide sensitive information before load it.


Running Percentage =
CALCULATE (
    [YTD Cumulative Turnover %],
    FILTER ( ALL ( Table ), Table[Date] <= MAX ( Table[Date] ) )
)


Thanks,
Angelia

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.