Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello experts,
My source data is following
| name | date | val | period |
| a | 1/1/2020 | 100 | 1 |
| a | 1/1/2020 | 200 | 1 |
| a | 1/2/2020 | 300 | 2 |
| a | 1/2/2020 | 400 | 2 |
| a | 1/3/2020 | 500 | 3 |
| a | 1/3/2020 | 600 | 3 |
| b | 1/1/2020 | 700 | 1 |
| b | 1/1/2020 | 800 | 1 |
| b | 1/2/2020 | 900 | 2 |
| b | 1/2/2020 | 1000 | 2 |
| b | 1/3/2020 | 1100 | 3 |
| b | 1/3/2020 | 1200 | 3 |
On a matrix viz I want to show the max of current period's value and what was the max of immediately preceeding period's value. My desired output is following
| name | date | _maxVal | _lastVal |
| a | 1/1/2020 | 200 | 0 |
| a | 1/2/2020 | 400 | 200 |
| a | 1/3/2020 | 600 | 400 |
| b | 1/1/2020 | 800 | 0 |
| b | 1/2/2020 | 1000 | 800 |
| b | 1/3/2020 | 1200 | 1000 |
I can't seem to figure out how to come to this. I have tried the following measure
Measure 3 =
VAR _1 = MAX('Table'[period])-1
VAR _2 = CALCULATE(MAXX(FILTER('Table','Table'[period]=_1),'Table'[val]))
RETURN _2
but I can't seem to figure out where it is going wrong
If you can please would be great.
Thank you in advance.
Solved! Go to Solution.
Sorry figured out by myself..
Measure 3 =
VAR _1 = MAX('Table'[period])-1
VAR _2 = CALCULATE(MAXX(FILTER('Table','Table'[period]=_1),'Table'[val]),ALLEXCEPT('Table','Table'[name]))
RETURN _2
Hi, @smpa01
Please try the below measure.
Max Val preceeding period =
VAR currentperiod =
MAX ( Data[period] )
RETURN
CALCULATE (
MAX ( Data[val] ),
FILTER ( ALLEXCEPT ( Data, Data[name] ), Data[period] = currentperiod - 1 )
)
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Sorry figured out by myself..
Measure 3 =
VAR _1 = MAX('Table'[period])-1
VAR _2 = CALCULATE(MAXX(FILTER('Table','Table'[period]=_1),'Table'[val]),ALLEXCEPT('Table','Table'[name]))
RETURN _2
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!