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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
jeannier2022
Regular Visitor

Dax prior year calculion

I have a dax calculation that errors out. i am very new to dax and trying to figure out what i did wrong. 

Total_Sales_Prior_Year =
VAR InventoryTypeFilter =
    FILTER (
        'SALES ORDER, SHIPMENT, & INVOICE DATA',
        [INVENTORY TYPE] = "GROWER"
    )
VAR SalesOrderStatusFilter =
    FILTER (
        'SALES ORDER STATUSES LUT',
        [SALES ORDER STATUS] = "SHIPPED"
    )
VAR StyleFilter =
    FILTER (
        'STYLE LUT',
        [INCLUDE/EXCLUDE] = "INCLUDE"
    )
VAR GradeFilter =
    FILTER (
        'GRADE LUT',
        [INCLUDE/EXCLUDE] = "INCLUDE"
    )
VAR v_Current_Year = MAX ( 'DATE LUT'[CROP YEAR] )
RETURN
    CALCULATE(
        SUM( 'SALES ORDER, SHIPMENT, & INVOICE DATA'[EQUIVALENT QUANTITY]),
        InventoryTypeFilter,
        SalesOrderStatusFilter,
        StyleFilter,
        GradeFilter,
        'Table'[Year Number] = v_Current_Year - 1
    )

 Not sure where to start with the troubleshooting 

3 REPLIES 3
FreemanZ
Super User
Super User

hi @jeannier2022 ,

 

what error do you get?

In Tabular editor i get Error  Syntax error near Total_Sales_Prior_Year. Expected EOF / DEFINE / EVALUATE

In Dax Studios 

jeannier2022_0-1699650024531.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.