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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
souzacaleb
Regular Visitor

How to create a measure that use result from old year selected as baseline to calculate future years

I would like to create a metric that use the total Emission from the Year selected as a baseline to calculate new values for the future years by 2024 to 2030 adding 1% of efficiency

(*) The % of efficiency is a variable that can be changed. for example: 1%, 5%,10% , etc
(**) The emission table has data from 2015 to 2019 in the example I´ve just selected the year 2019 as a baseline, but I should be able to select any other previous year available.

Emission Table

DateEmission
1/1/2019557
2/1/2019432
3/1/20191554
4/1/20192234
5/1/2019354
6/1/20194464
7/1/2019446
8/1/2019958
9/1/20193465
10/1/2019741
11/1/20196331
12/1/20194566

 


For example if I select the Year 2019 on the emission table I want to use the emission result from 2019 to calculate new values for  each month by 2024 to 2030 following these rule below

Emission for Jan 2024 = Emission of Jan 2019 - ( (Total Emission in the whole year 2019 /12 ) * 1%)
Emission for Feb 2024= Emission of Feb 2019 - ( (Total Emission in the whole year 2019 /12 ) * 1%) 
...
Emission for Jan 2025 = Emission of Jan 2024 - ( (Total Emission in the whole year 2024 /12 ) * 1%)
Emission for Feb 2025= Emission of Feb 2024 - ( (Total Emission in the whole year 2024 /12 ) * 1%)
...
Emission for Jan 2030 = Emission of Jan 2029 - ( (Total Emission in the whole year 2029 /12 ) * 1%)
Emission for Feb 2030= Emission of Feb 2029 - ( (Total Emission in the whole year 2029 /12 ) * 1%)

souzacaleb_1-1705603985882.png

 

 




1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @souzacaleb,

You can try to use the following measure formula to get the same period last year value as current period baseline:

formula =
//percentage value from new table
VAR _rate =
    MAX ( Selector[Rate] )
VAR currDate =
    MAX ( Table1[Date] )
VAR prevDate =
    DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) ) 
//last year same period emission
VAR LYMEmission =
    CALCULATE (
        SUM ( Table1[Emission] ),
        FILTER (
            ALLSELECTED ( Table1 ),
            YEAR ( [Date] ) = YEAR ( prevDate )
                && MONTH ( [Date] ) = MONTH ( prevDate )
        )
    ) 
//last year emission
VAR LYEmission =
    CALCULATE (
        SUM ( Table1[Emission] ),
        FILTER ( ALLSELECTED ( Table1 ), YEAR ( [Date] ) = YEAR ( prevDate ) )
    )
RETURN
    prevEmission - LYEmission / 12 * _rate

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @souzacaleb,

You can try to use the following measure formula to get the same period last year value as current period baseline:

formula =
//percentage value from new table
VAR _rate =
    MAX ( Selector[Rate] )
VAR currDate =
    MAX ( Table1[Date] )
VAR prevDate =
    DATE ( YEAR ( currDate ) - 1, MONTH ( currDate ), DAY ( currDate ) ) 
//last year same period emission
VAR LYMEmission =
    CALCULATE (
        SUM ( Table1[Emission] ),
        FILTER (
            ALLSELECTED ( Table1 ),
            YEAR ( [Date] ) = YEAR ( prevDate )
                && MONTH ( [Date] ) = MONTH ( prevDate )
        )
    ) 
//last year emission
VAR LYEmission =
    CALCULATE (
        SUM ( Table1[Emission] ),
        FILTER ( ALLSELECTED ( Table1 ), YEAR ( [Date] ) = YEAR ( prevDate ) )
    )
RETURN
    prevEmission - LYEmission / 12 * _rate

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.