cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Regular Visitor

## % Change Year over Year

Hi,

I am trying to create a measure formula that calculates the % change year over year that also takes into account changes from negative to positive numbers. I have the formula written out in excel below, but when I try to get the same formula written in PBI I get an error saying too few arguments passed. Any help would be greatly appreciated.

Excel Formula

=IF(LY %=0,0,(IF(LY %<0,(( LY % - TY %)/ LY %)*100,(( LY % - TY %)/ LY %)*-100)))

PBI Measure

% Change Calculated = IF([LY Shortage Rate Calculated]=0,0,IF([LY Shortage Rate Calculated]>0,([LY Shortage Rate Calculated]-[TY Shortage Rate Calculated]/[LY Shortage Rate Calculated])*-1,IF([LY Shortage Rate Calculated]-[TY Shortage Rate Calculated]/[LY Shortage Rate Calculated])))
2 ACCEPTED SOLUTIONS
Community Champion

You have an extra IF towards the end.  Should be

```% Change Calculated =
IF (
[LY Shortage Rate Calculated] = 0,
0,
IF (
[LY Shortage Rate Calculated] > 0,
( [LY Shortage Rate Calculated]
- [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
* -1,
( [LY Shortage Rate Calculated]  ##You had an extra IF here
- [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
)
)```
Regular Visitor

Thanks for the quick reply Dedelman_clng! I added in some divides into the formula with your change and it worked perfectly.

```% Change Calculated =
IF (
[LY Shortage Rate Calculated] = 0,
0,
IF (
[LY Shortage Rate Calculated] > 0,
**DIVIDE** ( [LY Shortage Rate Calculated]
- [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
* -1,
**DIVIDE**( [LY Shortage Rate Calculated] - [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
)
)```
2 REPLIES 2
Community Champion

You have an extra IF towards the end.  Should be

```% Change Calculated =
IF (
[LY Shortage Rate Calculated] = 0,
0,
IF (
[LY Shortage Rate Calculated] > 0,
( [LY Shortage Rate Calculated]
- [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
* -1,
( [LY Shortage Rate Calculated]  ##You had an extra IF here
- [TY Shortage Rate Calculated] / [LY Shortage Rate Calculated] )
)
)```
Regular Visitor

Thanks for the quick reply Dedelman_clng! I added in some divides into the formula with your change and it worked perfectly.

```% Change Calculated =
IF (
[LY Shortage Rate Calculated] = 0,
0,
IF (
[LY Shortage Rate Calculated] > 0,
**DIVIDE** ( [LY Shortage Rate Calculated]
- [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
* -1,
**DIVIDE**( [LY Shortage Rate Calculated] - [TY Shortage Rate Calculated] , [LY Shortage Rate Calculated] )
)
)```

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors