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 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.
If this post helps, then please consider accepting 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
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 |
---|---|
104 | |
101 | |
79 | |
72 | |
64 |
User | Count |
---|---|
142 | |
108 | |
101 | |
81 | |
74 |