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, 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 ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
@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.
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 |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |