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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
12101994
Regular Visitor

Last year revenue dax calculation

I've created a dax for last year revenue calculation using dateadd, sameperiodlastyear, previous year dax but none of them giving me the output which I'm expecting.
I've a fact table and dimension table for date. My fact table has a ship_date column which contains 1st of every month so for 12 months there are only 12 dates but my dim_date table contains 30-31 dates according to the month.
when I used the dax as calculate(sum(sales[revenue]),dateadd(dim_date[date],-1,year)) this is giving me different numbers.
I got the same result with sameperiodlastyear dax as well
prev_yr_rev = calculate(sum(sales[revenue]),sameperiodlastyear(dim_date[date]))
I tried different approaches as well
new_last_yr_dax

VAR BackYear =
    IF(
        ISBLANK(SELECTEDVALUE('dim_date'[FY])),
        BLANK(),
        "FY" & (VALUE(MID(SELECTEDVALUE('dim_date'[FY]), 3, 2)) - 1)
    )

VAR Result =
    CALCULATE(
        SUM('sales'[revenue]),
        TRIM('sales'[automated_fiscal]) = TRIM(BackYear)
    )



RETURN Result


automated_fiscal column contains FY23 as the value for the year FY24, FY24 for the year FY25 YTD and so on 
I have 3 years data in my fact and dimension table starting from FY23 to FY25 YTD.
So, the expected output should be as per the current year.

I don't understand why my new_last_yr_dax is not working and giving me blank for all the selected year.
Both FY column of dim_date and automated_fiscal are of text type, I'm just applying the filter condition in the dax and not even equating but still the result is blank.
Could you please help me  with the calculation 
I've attached the screenshot for the expected output and the output of my dax which is prev_year_cal

community question.png

1 REPLY 1
eileen_iTalent
Kudo Kingpin
Kudo Kingpin

Helpful resources

Announcements
May FBC25 Carousel

Fabric Monthly Update - May 2025

Check out the May 2025 Fabric update to learn about new features.

May 2025 Monthly Update

Fabric Community Update - May 2025

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