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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX to get the revenue for last 3 years along with the average of it

Hello,

 

I want to create a KPI to give me sum the revenue of the last 3 years and divide by 3.

 

Eg:

 

CALCULATE(sum(Table1[Orders_Revenue]),Prodtable[Product Level1] = "DPS", Fiscal Calendar[Calendar Year Aging]]] = {0,-1,-2},
Table4[SS Flag] >=1)) / 3

 

Any help will be appreciated.!

2 ACCEPTED SOLUTIONS
bhanu_gautam
Super User
Super User

@Anonymous Try using

 

AverageRevenueLast3Years :=
VAR StartDate = CALCULATE(
MIN(FiscalCalendar[Date]),
FiscalCalendar[Calendar Year Aging] = -2
)
VAR EndDate = CALCULATE(
MAX(FiscalCalendar[Date]),
FiscalCalendar[Calendar Year Aging] = 0
)
RETURN
CALCULATE(
SUM(Table1[Orders_Revenue]),
Prodtable[Product Level1] = "DPS",
Table4[SS Flag] >= 1,
DATESBETWEEN(FiscalCalendar[Date], StartDate, EndDate)
) / 3




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

Anonymous
Not applicable

Hi @Anonymous 

 

Thanks for the reply from bhanu_gautam .

 

It seems that you use four tables. I created a simple sample data for your reference. If this sample data is structurally different from the one you are using, could you please provide some sample data and expected results based on the sample data so that we can better help you? How to provide sample data in the Power BI Forum - Microsoft Fabric Community Please remove any sensitive data in advance.

 

My sample:

vxuxinyimsft_0-1739428005896.png

 

vxuxinyimsft_1-1739428019565.png

 

vxuxinyimsft_2-1739428034822.png

 

vxuxinyimsft_3-1739428069525.png

 

Create a measure

 

KPI_Revenue_Last_3_Years = 
CALCULATE(
    SUM(Table1[Orders_Revenue]),
    FILTER(
        Prodtable,
        Prodtable[Product Level1] = "DPS"
    ),
    FILTER(
        'Fiscal Calendar',
        'Fiscal Calendar'[Calendar Year Aging] IN {0, -1, -2}
    ),
    FILTER(
        'Table4',
        'Table4'[SS Falg] >= 1
    )
) / 3

 

 

Output:

vxuxinyimsft_4-1739428121628.png

 

Best Regards,
Yulia Xu

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous 

 

Thanks for the reply from bhanu_gautam .

 

It seems that you use four tables. I created a simple sample data for your reference. If this sample data is structurally different from the one you are using, could you please provide some sample data and expected results based on the sample data so that we can better help you? How to provide sample data in the Power BI Forum - Microsoft Fabric Community Please remove any sensitive data in advance.

 

My sample:

vxuxinyimsft_0-1739428005896.png

 

vxuxinyimsft_1-1739428019565.png

 

vxuxinyimsft_2-1739428034822.png

 

vxuxinyimsft_3-1739428069525.png

 

Create a measure

 

KPI_Revenue_Last_3_Years = 
CALCULATE(
    SUM(Table1[Orders_Revenue]),
    FILTER(
        Prodtable,
        Prodtable[Product Level1] = "DPS"
    ),
    FILTER(
        'Fiscal Calendar',
        'Fiscal Calendar'[Calendar Year Aging] IN {0, -1, -2}
    ),
    FILTER(
        'Table4',
        'Table4'[SS Falg] >= 1
    )
) / 3

 

 

Output:

vxuxinyimsft_4-1739428121628.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bhanu_gautam
Super User
Super User

@Anonymous Try using

 

AverageRevenueLast3Years :=
VAR StartDate = CALCULATE(
MIN(FiscalCalendar[Date]),
FiscalCalendar[Calendar Year Aging] = -2
)
VAR EndDate = CALCULATE(
MAX(FiscalCalendar[Date]),
FiscalCalendar[Calendar Year Aging] = 0
)
RETURN
CALCULATE(
SUM(Table1[Orders_Revenue]),
Prodtable[Product Level1] = "DPS",
Table4[SS Flag] >= 1,
DATESBETWEEN(FiscalCalendar[Date], StartDate, EndDate)
) / 3




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.