Forum Discussion
Balance difference between two dates (power query, or...)
- 5 years ago
Is column balance a measure? then you want to get the last balance and first balance of the selected period?
if yes, one quick example bellow,in the example, date between 2016/1/1, 2016/1/25. then I create a slicer and set the period
then, create the measure,
Measure = var _mindate=CALCULATE(MIN('Table'[orderdate]),ALLSELECTED('Table'))//get the min date of selected period var _maxdate=CALCULATE(MAX('Table'[orderdate]),ALLSELECTED('Table')) var _firstbalance=CALCULATE([balance],ALLSELECTED('Table'),'Table'[orderdate]=_mindate)// get the firstbalance of selected period var _lastbalance=CALCULATE([balance],ALLSELECTED('Table'),'Table'[orderdate]=_maxdate) return _lastbalance-_firstbalanceBest Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.
Is column balance a measure? then you want to get the last balance and first balance of the selected period?
if yes, one quick example bellow,
in the example, date between 2016/1/1, 2016/1/25. then I create a slicer and set the period
then, create the measure,
Measure =
var _mindate=CALCULATE(MIN('Table'[orderdate]),ALLSELECTED('Table'))//get the min date of selected period
var _maxdate=CALCULATE(MAX('Table'[orderdate]),ALLSELECTED('Table'))
var _firstbalance=CALCULATE([balance],ALLSELECTED('Table'),'Table'[orderdate]=_mindate)// get the firstbalance of selected period
var _lastbalance=CALCULATE([balance],ALLSELECTED('Table'),'Table'[orderdate]=_maxdate)
return _lastbalance-_firstbalance
Best Regards,
Community Support Team _ Tang
If this post helps, please consider Accept it as the solution✔️ to help the other members find it more quickly.