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
Anonymous
Not applicable

New column that subtract two rows of a table

Hello people,

 

I am new to Power BI. I need a new column that subtracts two rows of a table.

 

I have this table, and I need show the anual growth of each database, so I want to generate a column that subtracts the USED_GB of the current year less those of the previous year of each database.

 

GRANDEF_1-1684336388093.png

 

The idea is to generate this new column in DAX. How can I do that?

 

Thanks.

4 REPLIES 4
Anonymous
Not applicable

Hi Ajendra, 

 

This is the desire output, but I would like not view the rows with PREVIOUS_YEAR with empty values:

 

GRANDEF_1-1684511346425.png

 

Thanks. 

 

hi @Anonymous 

try to add a calculated column like:

column = 
VAR _pre =
    MAXX(
        FILTER(
            data,
            data[DATABASE]=EARLIER(data[DATABASE])
                &&YEAR(data[DATE])=YEAR(EARLIER(data[DATE]))-1
        ),
        data[USED_GB]
    )
RETURN
    [USED_GB] - _pre

it worked like:

FreemanZ_0-1684567505188.png

Anonymous
Not applicable

Hi FreemanZ, thanks for your help. 

 

I tried this, but my PowerBi showed this error (My table name is

'Consulta_Tamaño_Historico'), it seems to be related with EARLIER function. 
 

GRANDEF_0-1684766132917.png

 

Regards. 

Ajendra
Resolver I
Resolver I

Hello,

 

Please provide some dummy data alongwith the desire output. Thanks!!

 

Ajendra!

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.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.