Forum Discussion
Anonymous
6 years agoNot applicable
How do you calculate the incremental change between rows?
How would you calaculate the difference between rows based on a certain criteria shared between the rows? In this case a Power Station's name, and then its increase in capacity over time. I would lik...
Anonymous
6 years agoNot applicable
Anonymous -
For dynamic results, we need to use a DAX Measure.
Please see attached. The measure that calculates the difference is:
Capacity Change =
IF(
ISBLANK([Capacity On Date]),
BLANK(),
var _prev_date = LASTNONBLANK(
FILTER(
ALL('Date'[Date]),
'Date'[Date] < SELECTEDVALUE('Date'[Date])
),
[Capacity On Date]
)
return
[Capacity On Date] -
CALCULATE(
[Capacity On Date],
'Date'[Date] = _prev_date
)
)
I hope this helps. If it does, please Mark as a solution.
I also appreciate Kudos.
I also appreciate Kudos.
Anonymous
6 years agoNot applicable
Thanks for that. It is nearly there, but when you put the data in to a chart it shows the original capacity not the change in capacity
- Anonymous6 years agoNot applicable
Anonymous - Could you show the problematic chart? The example pbix appears to be working properly in a table visual:
- Anonymous6 years agoNot applicable
- Anonymous6 years agoNot applicable
Anonymous - Use the Date column from the Date table instead of Start Date.
As a general rule, you will want to create a Star Schema and then use the descriptive attributes from the dimension tables in your charts. This isn't necessary for very simple scenarios, but will be helpful to follow this best practice.