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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Percentage change with blank years

I need a solution for percentage change  when there is a year without values. In the example below i need that the % change and the difference of percentage points in 2015 that compares with 2013 instead 2014.

 

My formulas:

Valor (YoY;%) = IFERROR(([OptConsumoAgua]-[OptConsumoAgua_N-1])/[OptConsumoAgua];BLANK())

Valor (YoY;p.p.) = IFERROR([OptConsumoAgua]-[OptConsumoAgua_N-1];BLANK())*100

 

YOY problem.jpg

YOY problem.jpg

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Not sure how you calculate percentage value for previous year. 

 

In my test, I added a calculated column to return YearNo in previous row.

Previous year =
CALCULATE (
    MAX ( 'Year-percetange'[Ano] ),
    FILTER (
        ALL ( 'Year-percetange' ),
        'Year-percetange'[Ano] < EARLIER ( 'Year-percetange'[Ano] )
    )
)

Then, the measure for [OptConsumoAgua_N-1] is similar to:

OptConsumoAgua_N-1 =
CALCULATE (
    [OptConsumoAgua],
    FILTER (
        ALL ( 'Year-percetange' ),
        'Year-percetange'[Ano] = MAX ( 'Year-percetange'[Previous year] )
    )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Not sure how you calculate percentage value for previous year. 

 

In my test, I added a calculated column to return YearNo in previous row.

Previous year =
CALCULATE (
    MAX ( 'Year-percetange'[Ano] ),
    FILTER (
        ALL ( 'Year-percetange' ),
        'Year-percetange'[Ano] < EARLIER ( 'Year-percetange'[Ano] )
    )
)

Then, the measure for [OptConsumoAgua_N-1] is similar to:

OptConsumoAgua_N-1 =
CALCULATE (
    [OptConsumoAgua],
    FILTER (
        ALL ( 'Year-percetange' ),
        'Year-percetange'[Ano] = MAX ( 'Year-percetange'[Previous year] )
    )
)

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

 

 

 OptConsAgua_N-1  Function gives me a wrong result (see table), maybe because filters?

DUVIDA.png

 

 

 

Can you correct the function below?

OptConsAgua_N-1 = CALCULATE([OptConsAgua];FILTER(ALL('Optimização');'Optimização'[Ano]=max('Optimização'[Ano Anterior])))

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.