我已经在stackoverflow中尝试了几个答案,但实际上不适合我的情况 计算应动态计算列之间的差异。
Difference = var MaxYear = MAX(data[YEAR])
var MinYear = MIN(data[YEAR])
RETURN CALCULATE(SUM([Value]),data[YEAR]=MaxYear) - CALCULATE(SUM([Value]),data[YEAR]=MinYear)
#data :
Group YEAR Value
A 2015 12
B 2015 151
C 2015 12
D 2015 151
A 2016 568
B 2016 512
C 2016 568
D 2016 512
A 2017 15
B 2017 21
C 2017 15
D 2017 21
A 2018 5
B 2018 2345
C 2018 5
D 2018 2345
A 2019 68
B 2019 364
C 2019 68
D 2019 364
A 2020 15
B 2020 46
C 2020 15
D 2020 46
A 2015 12
B 2015 151
C 2015 12
D 2015 151
A 2016 568
B 2016 512
C 2016 568
D 2016 512
A 2017 15
B 2017 21
C 2017 15
D 2017 21
A 2018 5
B 2018 2345
C 2018 5
D 2018 2345
A 2019 68
B 2019 364
C 2019 68
D 2019 364
A 2020 15
B 2020 46
C 2020 15
D 2020 46