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.
Hello experts,
My sample data is as following
BU | Year | GL | Amount |
1 | 2016 | 511200 | 100 |
1 | 2017 | 511200 | 200 |
1 | 2018 | 511200 | 300 |
1 | 2019 | 511200 | 400 |
All I want is the DAX to calculate based on a filter selection on year the last 2 year's corresponding value.
e.g. if the reader selects 2019 from the filter, I want the following view to be returned in the matrix viz
BU | GL | Selected Year Amount | Selected Year-1 Amount | Selected Year-2 Amount |
1 | 511200 | 400 | 300 | 200 |
e.g. if the reader selects 2018 from the filter, I want the following tview to be returned in the matrix viz
BU | GL | Selected Year Amount | Selected Year-1 Amount | Selected Year-2 Amount |
1 | 511200 | 300 | 200 | 100 |
Thank you in advance,
Solved! Go to Solution.
Figured out as below
Selected Year-1 Total = VAR f=FILTERS('Table 1'[Year]) VAR f_1=f-1 VAR x=CALCULATE(SUM('Table 1'[Amount]),FILTER(ALL('Table 1'),'Table 1'[Year]=f_1)) RETURN x
Figured out as below
Selected Year-1 Total = VAR f=FILTERS('Table 1'[Year]) VAR f_1=f-1 VAR x=CALCULATE(SUM('Table 1'[Amount]),FILTER(ALL('Table 1'),'Table 1'[Year]=f_1)) RETURN x
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 |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
111 | |
94 | |
84 | |
67 |