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

Get Fabric Certified for FREE during Fabric Data Days. 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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors