Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Nicram
Regular Visitor

Aggregate Values for corresponding MAX date.

Hello Community!

I've been struggling for a few days with a running total measure.

So I have a dataset of issue ID, date, and status. It's an activity registry.
I'm trying to create a visual with running totals that counts a number of issues with per status. It should look like the graph below.

PowerBi_forum.png

 

Running totals are simple, the problem is to do pre-filtering on the last status on a given date.

I managed to get the status of the latest TimeStamp by MAXX and then a value corresponding to that time by:

 

 

M_LastMainStatus_SELECTEDVALUE =
VAR _maxTimeStamp =
    MAXX ( 'Table1', 'Table1'[TimeStamp] )
VAR _LastStatus =
    CALCULATE (
        SELECTEDVALUE ( 'Table1'[Status] ),
        'Table1'[TimeStamp] = _maxTimeStamp
    )
RETURN
    _LastMainStatus

 

 

This measure gives nice result in a table/matrix. However, I have a hard time incorporating it into a running total that 'says': on day one we had 5 active and 2 closed issues, on day two we had 4 active and 5 closed issues and so on.

 

Sample dataset below. An issue can be closed and active multiple times per day. It's a simplified version of my original table with more statuses (blanks included).

IDTimeStampStatus

1

01/01/2020 7:00Active
101/01/2020 8:00Closed
102/01/2020 8:00Active
201/01/2020 10:00Active
201/01/2020 11:00Closed
202/01/2020 10:00Active
202/01/2020 11:00Closed
301/01/2020 7:00Active
301/01/2020 8:00Active
302/01/2020 10:00Closed
302/01/2020 11:00Closed


I've tried DAX to combine CALCULATE, FILTER, COUNTROWS, SELECEDVALUE, ALL but I did not come close desired result. Existing topics on the forum didn't help either.

Do you have any suggestions? Have you ever faced a similar task?

I'd appreciate any kind of help!
Cheers,
Nicram

1 REPLY 1
amitchandak
Super User
Super User

@Nicram , Create a new date table and join it with date part of time stamp

new column

Date = datevalue([TimeStamp])

 

then try measures like

open = calculate(countrows(Table), Filter(all('Date'),'Date'[Date] <= Max('Date'[Date] )), filter(Table, Table[Status] = "Active")) -
calculate(countrows(Table), Filter(all('Date'),'Date'[Date] <= Max('Date'[Date] )), filter(Table, Table[Status] = "Closed"))

Active = calculate(countrows(Table),filter(Table, Table[Status] = "Active"))
closed = calculate(countrows(Table), filter(Table, Table[Status] = "Closed"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.