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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Dax Running Totals Help

Hello,

 

I am fairly new to DAX..

 

I have the table below...

dALY153_0-1652044582143.png

It is basically a table of Company statuses. It has a start date when the status was set, and a end date when a status was changed. Once changed a new row gets entered with the new status.

 

I want to be able to get a running total of by day split by status, but when their is an end subtract from the old status, and add to the new status. It's been driving me up the wall. Anyone got any ideas?

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please create a Calendar table.

 

Calendar = 
CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2022, 12, 31 ) )

vkkfmsft_0-1652237013696.png

 

Then create measure.

 

CountCompany = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[CompanyName] ),
    FILTER (
        'Table',
        'Table'[Start_Date] <= MAX ( 'Calendar'[Date] )
            && (
                'Table'[END_DATE] >= MAX ( 'Calendar'[Date] )
                    || 'Table'[END_DATE] = BLANK ()
            )
    )
)

vkkfmsft_1-1652237038897.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please create a Calendar table.

 

Calendar = 
CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2022, 12, 31 ) )

vkkfmsft_0-1652237013696.png

 

Then create measure.

 

CountCompany = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[CompanyName] ),
    FILTER (
        'Table',
        'Table'[Start_Date] <= MAX ( 'Calendar'[Date] )
            && (
                'Table'[END_DATE] >= MAX ( 'Calendar'[Date] )
                    || 'Table'[END_DATE] = BLANK ()
            )
    )
)

vkkfmsft_1-1652237038897.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello, 

 

Yes i used parts of your Measure, and it worked as intended. 

 

Thank you for the help. 

 

Thanks

 

Chris

tamerj1
Super User
Super User

tamerj1
Super User
Super User

Hi @Anonymous 

can you provide some sample data?

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.