Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi guys,
I am trying to return and matrix table with 3 years as columns: last_year, this_year and next_year
I made the following measure:
Result tabel 1 | |||
name | 2020 | 2021 | 2022 |
a | 1 | 4 | 7 |
b | 2 | 5 | 8 |
c | 3 | 6 | 9 |
Any help/tips are appreciated. Thanks in advance
Solved! Go to Solution.
@Anonymous , Try one of the two ways
Tons measure =
var this_year = YEAR(TODAY())
var previous_year = YEAR(TODAY())-1
var next_year = YEAR(TODAY()) +1
Return
SUMX(FILTER('Test Tabel', 'Test Tabel'[Date] in {this_year, previous_year, next_year}),'Test Tabel'[Tons]
)
or
Tons measure =
var this_year = YEAR(TODAY())
var previous_year = YEAR(TODAY())-1
var next_year = YEAR(TODAY()) +1
Return
SUMX(FILTER('Test Tabel', 'Test Tabel'[Date]>= previous_year && 'Test Tabel'[Date]<= next_year}),'Test Tabel'[Tons]
)
@Anonymous , Try one of the two ways
Tons measure =
var this_year = YEAR(TODAY())
var previous_year = YEAR(TODAY())-1
var next_year = YEAR(TODAY()) +1
Return
SUMX(FILTER('Test Tabel', 'Test Tabel'[Date] in {this_year, previous_year, next_year}),'Test Tabel'[Tons]
)
or
Tons measure =
var this_year = YEAR(TODAY())
var previous_year = YEAR(TODAY())-1
var next_year = YEAR(TODAY()) +1
Return
SUMX(FILTER('Test Tabel', 'Test Tabel'[Date]>= previous_year && 'Test Tabel'[Date]<= next_year}),'Test Tabel'[Tons]
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |