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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
paw1
Helper I
Helper I

% change calculation in power bi dax

Hi,

Can you please help me to calcualte % change from below data.

In each company the max date is different. 

for abc company  % change should be calcualted as = (09/30/2022 amount - 09/30/2021 amount)/09/30/2021 amount

for fgh company % change should be calcualted as = (12/31/2022 amount - 12/31/2021 amount)/12/31/2021 amount

 

CompanyDateAmount
abc06/30/2021  472000
abc09/30/2021  481100
abc06/30/2022  514762
abc09/30/2022  523000
fgh06/30/2021 684028.7
fgh09/30/2021 730662.7
fgh12/31/2021 880901.7
fgh06/30/2022 940806
fgh09/30/2022 950946.5
fgh12/31/2022 974673

 

@v-xinruzhu-msft 

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @paw1 

YoY% =
VAR _maxdate = MAX(TableName[Date])
VAR _value1 =
MAXX(
    FILTER(
        TableName, 
        TableName[Date]=_maxdate
    ),
   TableName[Amount]
)
VAR _value2 =
MAXX(
    FILTER(
        TableName, 
        TableName[Date]=EDATE(_maxdate, -12
    ),
   TableName[Amount]
)
RETURN
DIVIDE( _value1- _value2, _value2)

View solution in original post

1 REPLY 1
FreemanZ
Super User
Super User

hi @paw1 

YoY% =
VAR _maxdate = MAX(TableName[Date])
VAR _value1 =
MAXX(
    FILTER(
        TableName, 
        TableName[Date]=_maxdate
    ),
   TableName[Amount]
)
VAR _value2 =
MAXX(
    FILTER(
        TableName, 
        TableName[Date]=EDATE(_maxdate, -12
    ),
   TableName[Amount]
)
RETURN
DIVIDE( _value1- _value2, _value2)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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