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
Anonymous
Not applicable

DAX formula Running Total for previous year

I have the following measure for calculating the running total of customers.

Running Total Customers:=
CALCULATE(
COUNT('Customers'[CustomerId]);
FILTER(ALL(Date[CalendarDate]);Date[CalendarDate]<=MAX(Date[CalendarDate])
))

Works like a charm. Now i want to have a measure showing what the running total was the same period last year. i have not been able to solve this.

For example:

Year, RTC, RTCLY
2010, 66, 
2011, 77, 66
2012, 79, 77
2013, 90, 79

Please advice

1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@Anonymous

 

Please try with following measure for RTCL. And I create a new “Calendar Year” column in Date table.

CalendarYear = YEAR ( 'Date'[CalendarDate] )
Running Total Customers LY = 
CALCULATE (
    COUNT ( 'Customers'[CustomerId] ),
    FILTER (
        ALL ( 'Date'[CalendarDate] ),
        'Date'[CalendarDate] <= MAX ( 'Date'[CalendarDate] )
            && YEAR ( 'Date'[CalendarDate] ) < MAX ( 'Date'[CalendarYear] )
    )
)

DAX formula Running Total for previous year_1.jpg

 

Best Regards,
Herbert

View solution in original post

1 REPLY 1
v-haibl-msft
Employee
Employee

@Anonymous

 

Please try with following measure for RTCL. And I create a new “Calendar Year” column in Date table.

CalendarYear = YEAR ( 'Date'[CalendarDate] )
Running Total Customers LY = 
CALCULATE (
    COUNT ( 'Customers'[CustomerId] ),
    FILTER (
        ALL ( 'Date'[CalendarDate] ),
        'Date'[CalendarDate] <= MAX ( 'Date'[CalendarDate] )
            && YEAR ( 'Date'[CalendarDate] ) < MAX ( 'Date'[CalendarYear] )
    )
)

DAX formula Running Total for previous year_1.jpg

 

Best Regards,
Herbert

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.