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
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
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.