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.
Hello everyone,
I have sales data set containing sales amount of every stores in 3 different regions. Each region has their own sales target (column Target Sales), I want to calculate a cumulative sum of sales amount such that it is resetted once the target is reached or almost reached.
I tried using grouping method but do not get 100% desired result.
For example, for the South region, the 'Reset cumulative' works perfectly until group 3.
Group 1 includes 0.29 + 8.57 +
+
Hi @Greg_Deckler - Thanks for sharing, I have tried another approach to get the expected result.
@SailorMoon98 - Please check use the below measure for cummulative reset:
Hope it helps
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Hi @SailorMoon98 -create a measure to calcalte cumulative sales amount
Cumulative Sales =
CALCULATE(
SUM(Sales[Sales Amount]),
FILTER(
ALLSELECTED(Sales),
Sales[Date] <= MAX(Sales[Date])
)
)
Another measure that will reset the cumulative sales amount when the target is reached.
Reset Cumulative Sales =
VAR CurrentRegion = MAX(Sales[Region])
VAR CurrentTarget = MAX(Sales[Target Sales])
VAR SalesBeforeCurrentDate =
FILTER(
ALL(Sales),
Sales[Region] = CurrentRegion &&
Sales[Date] <= EARLIER(Sales[Date])
)
VAR CumulativeSalesUntilNow =
SUMX(
SalesBeforeCurrentDate,
Sales[Sales Amount]
)
VAR Groups =
GENERATE(
SalesBeforeCurrentDate,
VAR GroupIndex =
SUMX(
FILTER(
SalesBeforeCurrentDate,
Sales[Date] <= EARLIER(Sales[Date])
),
Sales[Sales Amount]
) / CurrentTarget
RETURN
ROW("GroupIndex", CEILING(GroupIndex, 1))
)
VAR CurrentGroup =
MAXX(
FILTER(
Groups,
Sales[Date] = EARLIER(Sales[Date])
),
[GroupIndex]
)
RETURN
IF(
CumulativeSalesUntilNow - (CurrentGroup - 1) * CurrentTarget < CurrentTarget,
CumulativeSalesUntilNow - (CurrentGroup - 1) * CurrentTarget,
0
)
Hope it helps.
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
Thanks @rajendraongole1!
I tried yourn second suggesstion but it still does not work.
@rajendraongole1 Tried to implement this on a test file. Was getting an error using EARLIER ( no previous row context ). So, tried to modify it but not working. See attached PBIX file below signature.
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 |
---|---|
15 | |
10 | |
10 | |
10 | |
10 |
User | Count |
---|---|
19 | |
14 | |
13 | |
11 | |
8 |