This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi guys
I am quite new to Power BI and I am struggling now with getting the value from the second latest date. So i have a table "Gesamt" like the following
| Name Code | Datum | Gewicht | DIFFDate |
| Person 1 | 15.01.2024 | 88 | 31 |
| Person 1 | 16.01.2024 | 89 | 30 |
| Person 1 | 17.01.2024 | 87 | 29 |
| Person 1 | 18.01.2024 | 88.5 | 28 |
| Person 1 | 19.01.2024 | 89.5 | 27 |
| Person 1 | 20.01.2024 | 87.5 | 26 |
| Person 2 | 21.01.2024 | 60.5 | 25 |
| Person 2 | 22.01.2024 | 60 | 24 |
| Person 2 | 23.01.2024 | 61 | 23 |
| Person 2 | 24.01.2024 | 59.5 | 22 |
| Person 2 | 15.01.2024 | 59 | 31 |
| Person 3 | 13.01.2024 | 70 | 33 |
| Person 3 | 14.01.2024 | 71 | 32 |
| Person 3 | 15.01.2024 | 69 | 31 |
| Person 3 | 16.01.2024 | 69.5 | 30 |
| Person 3 | 17.01.2024 | 70.5 | 29 |
| Person 3 | 18.01.2024 | 71.5 | 28 |
| Person 3 | 24.01.2024 | 72 | 22 |
I calculated the newest value of "Gewicht* with
//Try this
DifferenceSecondLatestLast =
VAR LatestRank = RANKX(ALL(Gesamt), CALCULATE(AVERAGE(Gesamt[DIFF Date])))
VAR SecondLatestRank = LatestRank - 1
RETURN
CALCULATE(
AVERAGE(Gesamt[Gewicht]),
FILTER(ALL(Gesamt), Rank IN {LatestRank, SecondLatestRank})
) -
CALCULATE(
AVERAGE(Gesamt[Gewicht]),
Rank = LatestRank
)
Hi
if I try this, I got an error message (as in the picture).
Even if I put the "Rank" in [ ] to define it's the measure, it's not working.
Also the "Latest Rank" does not define the latest rank, right? IS there a "Max" missig?
Thanks
You can add visual filter it works with measures and put the rank measure value to 2
Thanks Muhammad for your reply.
As I mentioned I want to calculate in another step with the second latest value (at the end it's the difference between the latest and the second latest). So only by filtering the visual it won't work. Or am I thinking in a wrong way?
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 39 | |
| 28 | |
| 28 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 37 | |
| 32 | |
| 26 | |
| 25 |