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.
Dear Key Users,
How could I add addtional conditions to identify the row results in cumulative calculations
As in the Table below mentioned, I need to cumulative the "Qty Delta" sort by the Month level, thats give me the column "**bleep** Qty Delta" in dax,
But I want this dax formula to add condition is if the "**bleep** Qty Delta" is positive, then the next cumulative calculation will take this positive as 0 in the next calculation, like how this will performed in column "Correct **bleep** Delta"
Thanks a lot for your help!
Chrystal
Solved! Go to Solution.
Thanks for the reply from lbendlin.
Hi @Chrystal ,
Create a new column and try the following DAX formula:
Result =
VAR Currentmonth='Table'[Month]
VAR CurrentQtyDelta='Table'[Qty Delta]
VAR PreviousResult=CALCULATE(SUM('Table'[Qty Delta]),FILTER('Table','Table'[Month]<Currentmonth&&'Table'[Qty Delta]<0))
RETURN
IF(CurrentQtyDelta>0,CurrentQtyDelta,PreviousResult+CurrentQtyDelta)
Result:
Best Regards,
Zhu
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for the reply from lbendlin.
Hi @Chrystal ,
Create a new column and try the following DAX formula:
Result =
VAR Currentmonth='Table'[Month]
VAR CurrentQtyDelta='Table'[Qty Delta]
VAR PreviousResult=CALCULATE(SUM('Table'[Qty Delta]),FILTER('Table','Table'[Month]<Currentmonth&&'Table'[Qty Delta]<0))
RETURN
IF(CurrentQtyDelta>0,CurrentQtyDelta,PreviousResult+CurrentQtyDelta)
Result:
Best Regards,
Zhu
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Conditional accumulation is impossible in DAX. The only way you can do this is in Power Query via List.Accumulate() .
Hi! thanks for your reply, I will check it out!!
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |