Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register 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
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 |
|---|---|
| 55 | |
| 35 | |
| 31 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 75 | |
| 72 | |
| 38 | |
| 35 | |
| 25 |