Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin 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.
I am working with a dataset in which I need to calculate a series of parameters into a "projection", one of which is the last known stock.
My formula to get this data into a calculated column is:
Solved! Go to Solution.
Hi @SSMalcontent ,
Please have a try.
PROJECAOEstoqueInicial =
VAR _1 =
MAXX (
FILTER (
PROJECAO,
PROJECAO[CODPROD] = EARLIER ( PROJECAO[CODPROD] )
&& PROJECAO[Data] <= EARLIER ( PROJECAO[Data] )
&& PROJECAO[EstoqueInicial] <> BLANK ()
),
PROJECAO[Data]
)
RETURN
SUMX (
FILTER (
PROJECAO,
PROJECAO[Data] = _1
&& PROJECAO[CODPROD] = EARLIER ( PROJECAO[CODPROD] )
),
PROJECAO[EstoqueInicial]
)
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @SSMalcontent ,
Please have a try.
PROJECAOEstoqueInicial =
VAR _1 =
MAXX (
FILTER (
PROJECAO,
PROJECAO[CODPROD] = EARLIER ( PROJECAO[CODPROD] )
&& PROJECAO[Data] <= EARLIER ( PROJECAO[Data] )
&& PROJECAO[EstoqueInicial] <> BLANK ()
),
PROJECAO[Data]
)
RETURN
SUMX (
FILTER (
PROJECAO,
PROJECAO[Data] = _1
&& PROJECAO[CODPROD] = EARLIER ( PROJECAO[CODPROD] )
),
PROJECAO[EstoqueInicial]
)
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Heya, thanks a lot mate! Worked like a charm!
Can you explain to me why me original formula didn't though? For what it looks like, your formula just broke it down in two pieces, but used the same arguments and functions... something to do with context, maybe?
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 38 | |
| 31 | |
| 27 | |
| 26 |