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, I have the following calculated column in a table called 'Admin':
Diff = [Quantidade]-LOOKUPVALUE(
Admin[Quantidade],Admin[Código],[Código],Admin[Data],
CALCULATE(
Max(Admin[Data]),
FILTER(
Admin,Admin[Código]=EARLIER(Admin[Código])&&Admin[Data]<EARLIER(Admin[Data])
)
)
)I can´t figure it out as a measure. Please help
TIA
Solved! Go to Solution.
@Fcoatis , you may want to try,
Delta =
VAR __dt = MAX ( Admin[Data] )
VAR __tb =
TOPN (
1,
CALCULATETABLE ( Admin, ALLEXCEPT ( Admin, Admin[Código] ), Admin[Data] < __dt ),
Admin[Data]
)
RETURN
MAX ( Admin[Quantidade] ) - MAXX ( __tb, Admin[Quantidade] )
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
@Fcoatis When you use column or calculated column in your measure, you have to use it with some aggreage function like sum, max, min, count etc.
in calculated column you can use directly column name without using aggreage function.
for specify solution of your problem, you may share your powerbi file.
Proud to be a Super User!
@Fcoatis , you may want to try,
Delta =
VAR __dt = MAX ( Admin[Data] )
VAR __tb =
TOPN (
1,
CALCULATETABLE ( Admin, ALLEXCEPT ( Admin, Admin[Código] ), Admin[Data] < __dt ),
Admin[Data]
)
RETURN
MAX ( Admin[Quantidade] ) - MAXX ( __tb, Admin[Quantidade] )
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Thank you, thats it.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 66 | |
| 46 | |
| 42 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 196 | |
| 126 | |
| 101 | |
| 67 | |
| 49 |