Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

HELP ON CUMULATIVE CALCULATION

hi, this is my monthly data ( Month as number 1, 2,3 .. )

Month               
BLOCKGlobal Mgmt 123456789101112
INDIAOverheadsCola-              0.28                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15
INDIAOverheadsPepsi                0.02                0.00                0.00                0.00                0.00                0.00                0.00                0.00                0.00                0.00                0.00                0.00
JAPANOverheadsCola-              0.07                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15                0.15
JAPANOverheadsPepsi-              0.02                0.06                0.06                0.06                0.06                0.06                0.06                0.06                0.06                0.06                0.06                0.06
USAUnderCola-              0.00                0.09                0.09                0.09                0.09                0.09                0.09                0.09                0.09                0.09                0.09                0.09
USAunderLime                0.00                0.03                0.03                0.03                0.03                0.03                0.03                0.03                0.03                0.03                0.03                0.03

What I am struggling and my requiremnt  is..

 

If I select India, Overhead and Pepsi with

Month 1 : My value should come -0.28

Month 2 : -0.13

MOnth 3: 0.02

i.e Cummulative addition based on the Block , Global , Mgmt and month number filter.

 

 

 

 

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

After unpivoting your table, you could create a new column to show the data.

Column =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        'Table',
        'Table'[Attribute] <= EARLIER ( 'Table'[Attribute] )
            && 'Table'[Mgmt ] = EARLIER ( 'Table'[Mgmt ] )
            && 'Table'[BLOCK] = EARLIER ( 'Table'[BLOCK] )
    )
)

2-1.PNG

Here is my test file for your reference.

 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

8 REPLIES 8
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

After unpivoting your table, you could create a new column to show the data.

Column =
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER (
        'Table',
        'Table'[Attribute] <= EARLIER ( 'Table'[Attribute] )
            && 'Table'[Mgmt ] = EARLIER ( 'Table'[Mgmt ] )
            && 'Table'[BLOCK] = EARLIER ( 'Table'[BLOCK] )
    )
)

2-1.PNG

Here is my test file for your reference.

 

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

thank you all of you. This has resolved my problem.

 

FrankAT
Community Champion
Community Champion

Hi,

you can do it like this:

 

09-03-_2020_16-39-05.png

 

REgrads FrankAT

 

Anonymous
Not applicable

90% correct, I did the same way but why if I take the monthe number as a seperate slicer/filter and If I select 2, the output is not coming as -0.13 or If I select 3 the output is not coming as 0.02.

 

 

 

Hi @Anonymous,

 

try this:

 

09-03-_2020_17-25-20.png

 

or change the slicer properties like this:

09-03-_2020_17-32-32.png

Regards FrankAT

 

amitchandak
Super User
Super User

If you are using date the you can use following for cumulative

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(date,date[date] <=maxx(date,date[date])))

 

If you have month No,

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all(Table),Table[Month] <=maxx(Table,Table[Month])))

 

That will work with year.

 

Anonymous
Not applicable

hi,

 

the output is not as expecetd if I select the filters like Block , Global and MGT. The cummulative is working fine based on the month no .

 

 

If you have date, prefer the formula In given with date using date calendar.  If you can create date using month and year do that.

If not, move month to another table and then use all(Month) in the filter (all(month), month[month]<=max(month[month]))

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.