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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
achanikya
Helper I
Helper I

calculation

Hi Tema 

 

Could anyone please explain me how we convert the excel formula (highlighted in screenshot) to power BI explain me.

achanikya_0-1665726110434.png

 

Thanks 
chanikya A

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @achanikya ,

Assume that you have the table data as below screenshot, you can create a measure as below to get it. Please find the details in the attachment.

yingyinr_0-1666080607219.png

Percent = 
VAR _2021 =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Year] = 2021 )
VAR _2022 =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Year] = 2022 )
VAR _percent =
    IF ( ISBLANK ( _2021 ) || _2021 = 0, BLANK (), DIVIDE ( _2022 - _2021, _2021 ) )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Year] ),
        SUM ( 'Table'[Value] ),
        _percent
    )

yingyinr_1-1666080658381.png

 

What your raw data looks like? Could you please provide some sample data(exclude sensitive data) and your final expected result? Do you want to get the difference percentage between current year and previous year? Thank you.

Best Regards

View solution in original post

6 REPLIES 6
Dinesh_Suranga
Continued Contributor
Continued Contributor

@achanikya 

Hi

You can try following DAX.

Measure = (SUM('TableName'[2022]) - SUM('TableName'[2021])) / SUM('TableName'[2021])

If you use one mesure to both years then this DAX will not work.

Thank you.

Hi @Dinesh_Suranga 

I need a daynamic calculations pls let me know 

Thanks 

chanikya A

@achanikya 

Please share some sample data with actual column names.

Thank you.

achanikya_0-1665739627448.png

pls share the emai Id 

Thanks 

Chanikya A

Anonymous
Not applicable

Hi @achanikya ,

Assume that you have the table data as below screenshot, you can create a measure as below to get it. Please find the details in the attachment.

yingyinr_0-1666080607219.png

Percent = 
VAR _2021 =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Year] = 2021 )
VAR _2022 =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Year] = 2022 )
VAR _percent =
    IF ( ISBLANK ( _2021 ) || _2021 = 0, BLANK (), DIVIDE ( _2022 - _2021, _2021 ) )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Year] ),
        SUM ( 'Table'[Value] ),
        _percent
    )

yingyinr_1-1666080658381.png

 

What your raw data looks like? Could you please provide some sample data(exclude sensitive data) and your final expected result? Do you want to get the difference percentage between current year and previous year? Thank you.

Best Regards

@Anonymous Hi thask for help 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.