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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.