The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi guys,
I've a table like this
date | Type | Qty |
01/01/2024 | A | 2 |
01/01/2024 | B | -1 |
01/01/2024 | B | -8 |
01/01/2024 | B | -3 |
01/01/2024 | A | 9 |
01/01/2024 | A | 10 |
01/02/2024 | A | 5 |
01/02/2024 | B | -1 |
01/02/2024 | B | -2 |
01/03/2024 | A | 6 |
01/03/2024 | A | 7 |
01/03/2024 | B | -2 |
i need to calculate total A and total B for each month. The total of last month must be the inizial total of current month. For example:
In january the total is 9.
The initial value in february is 9 --> 9 + 5 - 3 = 11
The initial value in march is 11... etc etc
How Can i replicate this table?
Thank you all 🙂
Solved! Go to Solution.
Hi, @giuliapiazza94
Try below measure
Measure =
VAR a = SUMX(
FILTER(
ALLSELECTED(
'Table'[date],
'Table'[Qty]
),
'Table'[date] <= MAXX(
FILTER(
ALLSELECTED('Table'[date]),
'Table'[date] < MIN('Table'[date])
),
[date]
)
),
'Table'[Qty]
)
VAR b = SUM('Table'[Qty]) + a
RETURN
IF(
ISINSCOPE('Table'[Type]),
SUM('Table'[Qty]),
b
)
You can download .pbix file.
Best Regards,
Dangar
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @giuliapiazza94
Try below measure
Measure =
VAR a = SUMX(
FILTER(
ALLSELECTED(
'Table'[date],
'Table'[Qty]
),
'Table'[date] <= MAXX(
FILTER(
ALLSELECTED('Table'[date]),
'Table'[date] < MIN('Table'[date])
),
[date]
)
),
'Table'[Qty]
)
VAR b = SUM('Table'[Qty]) + a
RETURN
IF(
ISINSCOPE('Table'[Type]),
SUM('Table'[Qty]),
b
)
You can download .pbix file.
Best Regards,
Dangar
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
15 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
8 | |
8 |