Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I'm hoping you good folk can help as I feel like I've hit a wall.
I've created a calculated table with two columns 'Date' & 'Costs'. I'm trying to create a new column for the growth, from the previous row to the current row. In excel, it's an easy ([CURRENT]-[PREV])/[PREV].
I've tried the following, but neither work and I can't find anything on this at all:
| Date | Costs | Growth |
| 2022-04 | £316,742.58 | 0.00% |
| 2022-05 | £339,554.79 | 7.20% |
| 2022-06 | £318,563.10 | -6.18% |
| 2022-07 | £328,800.01 | 3.21% |
| 2022-08 | £336,192.01 | 2.25% |
| 2022-09 | £335,042.44 | -0.34% |
| 2022-10 | £364,598.18 | 8.82% |
| 2022-11 | £347,276.07 | -4.75% |
| 2022-12 | £349,602.02 | 0.67% |
| 2023-01 | £353,896.81 | 1.23% |
| 2023-02 | £329,560.58 | -6.88% |
| 2023-03 | £326,710.33 | -0.86% |
Any help would be greatly appreciated.
Thank you in advance!
Solved! Go to Solution.
Hi @Nerf_Herder ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) Click "transform data" to enter the power query editor, change the data type of the [Costs] column to "Decimal number" type, sort the date column in ascending order, and then add the index column.
(3)Click "Close and Apply" to go back to desktop and create a calculated column.
Column =
var _current='Table'[Costs]
var _prev=CALCULATE(SUM('Table'[Costs]),FILTER('Table','Table'[Index]=EARLIER('Table'[Index])-1))
return DIVIDE(_current-_prev,_prev,0)
(4) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Nerf_Herder ,
According to your description, here are my steps you can follow as a solution.
(1) My test data is the same as yours.
(2) Click "transform data" to enter the power query editor, change the data type of the [Costs] column to "Decimal number" type, sort the date column in ascending order, and then add the index column.
(3)Click "Close and Apply" to go back to desktop and create a calculated column.
Column =
var _current='Table'[Costs]
var _prev=CALCULATE(SUM('Table'[Costs]),FILTER('Table','Table'[Index]=EARLIER('Table'[Index])-1))
return DIVIDE(_current-_prev,_prev,0)
(4) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous,
That worked a treat, thank you so much for your help!
Cheers,
Ian.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |