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
Sofia_A
New Member

How do I remove a year that doesn't have data in power BI while calculating YoY growth

Growth will be calculated from 2020 to 2022 as there was no sales in 2021

Sofia_A_0-1699209228118.png

 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @Sofia_A ,


Not sure if i fully get you. Supposing you have a data table like:

FreemanZ_2-1699237813280.png


you may try:
1) create a dates table like:

dates = ADDCOLUMNS( CALENDARAUTO(), "Year", YEAR([date]) )

2) relate the dates[date] with data[date] with 1:M relationship.
3) try to plot at table visual with dates[Year] column and a measure like:

 

AmtPY = 
VAR _lastrecordday =
MAXX(
    FILTER(
        ALL(data),
        data[date]<MIN(dates[date])
    ),
data[Date]
)
VAR _result =
SUMX(
    FILTER(
        ALL(data),
        YEAR(data[date]) = YEAR(_lastrecordday)
    ),
    data[Amt]
)
RETURN COALESCE(_result, 0)

 

 

it worked like:

FreemanZ_0-1699238106563.png

 

 

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @Sofia_A ,


Not sure if i fully get you. Supposing you have a data table like:

FreemanZ_2-1699237813280.png


you may try:
1) create a dates table like:

dates = ADDCOLUMNS( CALENDARAUTO(), "Year", YEAR([date]) )

2) relate the dates[date] with data[date] with 1:M relationship.
3) try to plot at table visual with dates[Year] column and a measure like:

 

AmtPY = 
VAR _lastrecordday =
MAXX(
    FILTER(
        ALL(data),
        data[date]<MIN(dates[date])
    ),
data[Date]
)
VAR _result =
SUMX(
    FILTER(
        ALL(data),
        YEAR(data[date]) = YEAR(_lastrecordday)
    ),
    data[Amt]
)
RETURN COALESCE(_result, 0)

 

 

it worked like:

FreemanZ_0-1699238106563.png

 

 

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.