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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Revenue Formula

I have this table:

1.PNG

I didn't post revenue amounts for security reasons, but the column is just called "revenue" and there is an amount associated with each invoice date. What I'm trying to figure out is how to calculate the sum of revenue for each account (co) for the last 3 months, then taking that sum and multiplying it by 4. The tricky part is keeping it dynamic. New invoice dates populate each month, so as time progresses it will always need to calculate the most previous 3 months of revenue. So for instance, May is almost over, so once June comes it would need to take the sum of revenue for March, April and May for each account and multiply that sum by 4 to get an annual revenue amount for each account. Is this possible?

 

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

Hi mrainey,

 

It's a classic running total question. Create a measure and use DAX formula like pattern below:

Result =
CALCULATE (
    SUM ( table[value] ),
    ALLEXCEPT ( table, table[Co] ),
    FILTER (
        table,
        table[Invoice Date]
            >= MAX ( table[Invoice Date] ) - 4
            && table[Invoice Date]
                <= MAX ( table[Invoice Date] - 1 )
    )
)
    * 4

Regards,

Jimmy Tao

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

Hi mrainey,

 

It's a classic running total question. Create a measure and use DAX formula like pattern below:

Result =
CALCULATE (
    SUM ( table[value] ),
    ALLEXCEPT ( table, table[Co] ),
    FILTER (
        table,
        table[Invoice Date]
            >= MAX ( table[Invoice Date] ) - 4
            && table[Invoice Date]
                <= MAX ( table[Invoice Date] - 1 )
    )
)
    * 4

Regards,

Jimmy Tao

kcantor
Community Champion
Community Champion

@AnonymousI would recommend just creating th calculation without the date constraints. When you put it on the report page, load your datekey as a visual, page, or report level filter and use the Relative Date filter function to set it for "In the last 3 months" which will cause the calculation to be dynamic.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors