Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Everyone, I am trying to calculate Percentage Change and Value Difference group by ID in the Power BI report. Please suggest the optimal way to do it. Thanks a lot.
Original Table:
ID | Salary | Effective Date | End Date |
1001 | 500 | 01/04/2018 | 25/07/2018 |
1001 | 700 | 26/07/2018 | 18/03/2019 |
1001 | 850 | 19/03/2019 | 31/12/2999 |
1002 | 1100 | 16/07/2019 | 31/12/2999 |
1003 | 1500 | 01/05/2019 | 31/12/2019 |
1003 | 1750 | 01/01/2020 | 31/12/2999 |
Result Table:
ID | Salary | Effective Date | End Date | Salary Change | Percent Change |
1001 | 500 | 01/04/2018 | 25/07/2018 | 0 | 0 |
1001 | 700 | 26/07/2018 | 18/03/2019 | 200 | 40 |
1001 | 850 | 19/03/2019 | 31/12/2999 | 150 | 21.4 |
1002 | 1100 | 16/07/2019 | 31/12/2999 | 0 | 0 |
1003 | 1500 | 01/05/2019 | 31/12/2019 | 0 | 0 |
1003 | 1750 | 01/01/2020 | 31/12/2999 | 250 | 16.66 |
Solved! Go to Solution.
hi @Meghbajaj
try to add two columns like this:
Salary Change 2 =
VAR _id = [ID]
VAR _date = [Effective Date]
VAR _table =
FILTER(TableName, TableName[ID]=_id)
VAR _datepre =
MAXX(
FILTER(_table, TableName[Effective Date]<_date),
TableName[Effective Date]
)
VAR _salarypre =
MINX(
FILTER(_table, TableName[Effective Date]=_datepre),
TableName[Salary]
)
RETURN
IF( _salarypre<>BLANK(), [Salary] - _salarypre)
Percent Change 2 =
VAR _id = [ID]
VAR _date = [Effective Date]
VAR _table =
FILTER(TableName, TableName[ID]=_id)
VAR _datepre =
MAXX(
FILTER(_table, TableName[Effective Date]<_date),
TableName[Effective Date]
)
VAR _salarypre =
MINX(
FILTER(_table, TableName[Effective Date]=_datepre),
TableName[Salary]
)
RETURN
IF( _salarypre<>BLANK(), DIVIDE( [Salary] - _salarypre, _salarypre))
it worked like this:
hi @Meghbajaj
try to add two columns like this:
Salary Change 2 =
VAR _id = [ID]
VAR _date = [Effective Date]
VAR _table =
FILTER(TableName, TableName[ID]=_id)
VAR _datepre =
MAXX(
FILTER(_table, TableName[Effective Date]<_date),
TableName[Effective Date]
)
VAR _salarypre =
MINX(
FILTER(_table, TableName[Effective Date]=_datepre),
TableName[Salary]
)
RETURN
IF( _salarypre<>BLANK(), [Salary] - _salarypre)
Percent Change 2 =
VAR _id = [ID]
VAR _date = [Effective Date]
VAR _table =
FILTER(TableName, TableName[ID]=_id)
VAR _datepre =
MAXX(
FILTER(_table, TableName[Effective Date]<_date),
TableName[Effective Date]
)
VAR _salarypre =
MINX(
FILTER(_table, TableName[Effective Date]=_datepre),
TableName[Salary]
)
RETURN
IF( _salarypre<>BLANK(), DIVIDE( [Salary] - _salarypre, _salarypre))
it worked like this:
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
76 | |
61 | |
37 | |
33 |
User | Count |
---|---|
99 | |
56 | |
51 | |
42 | |
40 |