Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi
I have the following data
I would like to create a column subtracting the previous value, so I get a usage per line
Appreciate any help
Thanks
Steve
Solved! Go to Solution.
Hi @FrontierGroup ,
follow these steps.
1. Add the Index column like this.
(Edit queries-->Add column--> Index Column--> from 1)
2. You will get the Output something like this: (close and Apply after these steps)
3. Now add this calculated Column like this and add the formula:
Difference =
var curIndex = 'Table'[Index]
var curCI = 'Table'[CI]
var OLDIndex = 'Table'[Index]-1
var oldVal = CALCULATE(
FIRSTNONBLANK('Table'[CI],1),
FILTER('Table',
'Table'[Index]=OLDIndex))
return IF(CONTAINS('Table','Table'[Index],OLDIndex), curCI-oldVal, 0)My output based on your sample:
Let me know if this works.
Thanks,
Tejaswi
Hi @FrontierGroup ,
follow these steps.
1. Add the Index column like this.
(Edit queries-->Add column--> Index Column--> from 1)
2. You will get the Output something like this: (close and Apply after these steps)
3. Now add this calculated Column like this and add the formula:
Difference =
var curIndex = 'Table'[Index]
var curCI = 'Table'[CI]
var OLDIndex = 'Table'[Index]-1
var oldVal = CALCULATE(
FIRSTNONBLANK('Table'[CI],1),
FILTER('Table',
'Table'[Index]=OLDIndex))
return IF(CONTAINS('Table','Table'[Index],OLDIndex), curCI-oldVal, 0)My output based on your sample:
Let me know if this works.
Thanks,
Tejaswi
Hi Tejaswi
Thank you for your quick response and the solution you detailed works perfectly!
Thanks for your help
Steve
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 51 | |
| 46 | |
| 23 | |
| 19 |
| User | Count |
|---|---|
| 138 | |
| 111 | |
| 50 | |
| 33 | |
| 29 |