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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

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
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.