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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
GRANDEF
Regular Visitor

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
GRANDEF
Regular Visitor

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 @GRANDEF 

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

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.