Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi all
Below is a simple table.
I want to calculate the AMOUNT_LEFT with a formula.
In the (explanation) field I have mentioned how the formula looks like.
The mutation_dates must be ranked (first date on top)
Can somebody help me out, thanks!
John
| bottle_nr | capacity_bottle_in_kg | mutation_date | amount_used | amount_left | (explanation) |
| 8448 | 12 | 5-2-2018 | 1 | 11 | 12-1=11 |
| 8448 | 12 | 26-2-2018 | 4 | 7 | 11-4=7 |
Solved! Go to Solution.
Create a calculated column like below:
amount_left =
VAR CurrentBottleNumber = 'Table'[bottle_nr]
VAR CurrentMutationDate = 'Table'[mutation_date]
VAR CurrentBottleCapacity = 'Table'[capacity_bottle_in_kg]
VAR UsedTableFilter =
FILTER (
'Table',
'Table'[bottle_nr] = CurrentBottleNumber
&& 'Table'[mutation_date] <= CurrentMutationDate
)
VAR UsedBottleCapcity =
CALCULATE ( SUM ( 'Table'[amount_used] ), UsedTableFilter )
RETURN
CurrentBottleCapacity - UsedBottleCapcity
Hi,
I am assuming you want to write a measure so that you obtain a dynamic solution for changes made in slicers/filters. Share the link from where i can download your PBI file.
Create a calculated column like below:
amount_left =
VAR CurrentBottleNumber = 'Table'[bottle_nr]
VAR CurrentMutationDate = 'Table'[mutation_date]
VAR CurrentBottleCapacity = 'Table'[capacity_bottle_in_kg]
VAR UsedTableFilter =
FILTER (
'Table',
'Table'[bottle_nr] = CurrentBottleNumber
&& 'Table'[mutation_date] <= CurrentMutationDate
)
VAR UsedBottleCapcity =
CALCULATE ( SUM ( 'Table'[amount_used] ), UsedTableFilter )
RETURN
CurrentBottleCapacity - UsedBottleCapcity
Its working, thanks a lot!
John
@Anonymous
that means.... Do you want display recent transacation... ?
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 45 | |
| 38 | |
| 34 | |
| 21 | |
| 17 |
| User | Count |
|---|---|
| 66 | |
| 64 | |
| 31 | |
| 26 | |
| 26 |