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
jjsander
Regular Visitor

Running total with latest transaction information

Hello,

I have been struggling with this DAX formula for months now and the application is now occurring in several different areas of our business. I have date stamped transactional data such as the below. You can see there are duplicate Job numbers to reflect every time the status was changed. 

 

I would like to do a running count of jobs over time. My challenge is coming up with a formula that can perform the running calculation* and also filter out the older job number rows in the process**. I can do each separately but am struggling to marry the two together. 

 

Any help would be appreciated. 

 

Thanks in advance,

 

Jon

 

*running_total = CALCULATE( COUNT( [job number] ), FILTER( ALLSELECTED( 'Dates'[Date] ), 'Dates'[Date] <= MAX( 'Dates'[Date]) )))

 

**most_recent_jobs = FILTER( jobstatus, jobstatus[Change Date] = CALCULATE( MAX( jobstatus[Change Date]), ALLEXCEPT( jobstatus, jobstatus[Job Number])))

 

Job NumberStatusChange Date
10051SCH3/27/2013 0:00
10051WPLN3/27/2013 0:00
10052EAPPR3/27/2013 0:00
10052INPRG3/27/2013 0:00
10052WENG3/27/2013 0:00
10051COMP3/28/2013 0:00
10051CLOSE4/10/2013 0:00
10052WI9/16/2014 0:00
10052CLOSE11/30/2015 0:00
100508WPLN3/11/2017 0:00
100508WSCHED3/11/2017 0:00
100508SCH3/14/2017 0:00
100508NO WORK4/25/2017 0:00
100508CLOSE5/15/2017 0:00
1 REPLY 1
wdx223_Daniel
Super User
Super User

IF(max(jobstatus[Change Date])=CALCULATE( MAX( jobstatus[Change Date]), ALLEXCEPT( jobstatus, jobstatus[Job Number])),CALCULATE( COUNT( [job number] ), FILTER( ALLSELECTED( 'Dates'[Date] ), 'Dates'[Date] <= MAX( 'Dates'[Date]) )))))

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.