Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Dear, Good afternoon, i'm breaking my head with this problem, i need to calculate the balance stock with last amount by product by inventory, my data model is:
Date Product Amount Inventory
02/01/2018 1,00 1119 801
08/01/2018 1,00 1120 801
09/01/2018 1,00 1110 801
10/01/2018 1,00 1111 801
I'de like that result stay like this with amount by day:
Date Product Amount Inventory
02/01/2018 1,00 1119 801
03/01/2018 1,00 1119 801
04/01/2018 1,00 1119 801
05/01/2018 1,00 1119 801
06/01/2018 1,00 1120 801
07/01/2018 1,00 1120 801
08/01/2018 1,00 1120 801
09/01/2018 1,00 1110 801
10/01/2018 1,00 1111 801
i made this formula but the result don't work with i'de, someone have any idea ?
amountCurrent =
VAR ultimoValor = CALCULATE(
SUM('public f_saldo_historico'[amount]);
FILTER(
'public d_data';
MAX('public f_saldo_historico'[date]) = 'public d_date'[date]
)
)
Solved! Go to Solution.
Hi @Jonathas,
Please download the demo from the attachment.
Measure = VAR stopDate = CALCULATE ( MAX ( 'public f_saldo_historico'[Date] ), ALL ( 'public d_date' ), ALL ( 'public f_saldo_historico' ) ) VAR lastMaxDate = CALCULATE ( MAX ( 'public f_saldo_historico'[Date] ), FILTER ( ALL ( 'public d_date'[Date] ), 'public d_date'[Date] <= MAX ( 'public d_date'[Date] ) ) ) RETURN IF ( MAX ( 'public d_date'[Date] ) <= stopDate, CALCULATE ( MAX ( 'public f_saldo_historico'[Amount] ), FILTER ( ALL ( 'public d_date'[Date] ), 'public d_date'[Date] = lastMaxDate ) ) )
Best Regards,
Dale
Hi @Jonathas,
Please download the demo from the attachment.
Measure = VAR stopDate = CALCULATE ( MAX ( 'public f_saldo_historico'[Date] ), ALL ( 'public d_date' ), ALL ( 'public f_saldo_historico' ) ) VAR lastMaxDate = CALCULATE ( MAX ( 'public f_saldo_historico'[Date] ), FILTER ( ALL ( 'public d_date'[Date] ), 'public d_date'[Date] <= MAX ( 'public d_date'[Date] ) ) ) RETURN IF ( MAX ( 'public d_date'[Date] ) <= stopDate, CALCULATE ( MAX ( 'public f_saldo_historico'[Amount] ), FILTER ( ALL ( 'public d_date'[Date] ), 'public d_date'[Date] = lastMaxDate ) ) )
Best Regards,
Dale
@v-jiascu-msft I hava a new problem, when i select more than product, the total stay mistake, because it do not consider the total by product, can you help me
?different result
Hi @Jonathas,
I can't see a total in your image. I just see two records (rows). I would suggest you create a new post in this forum with a sample and the formula you used.
Best Regards,
Dale
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
81 | |
75 | |
60 | |
37 | |
33 |
User | Count |
---|---|
102 | |
56 | |
52 | |
46 | |
40 |