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

Create measure/Column with incremental sum

Hello ,

 

I've senerio like below.


PART   PRIORITY        ORD_DATE             BO_QTY     
P1             28        5/4/2020 0:00                 30                  
P1             29        4/17/2020 0:00              10                   
P1             29        4/17/2020 0:00              20                  
P1             29        5/12/2020 0:00              70                  
P1             29       5/12/2020 0:00              110                                                                                                                                        Output measure should be like below , Which sould be having the cumulative sum of QTY


DATE,PRIORITY and PART all are duplicated, So we can not consider any key for addition.

 

PART   PRIORITY        ORD_DATE             BO_QTY     Output Measure/Column
P1             28        5/4/2020 0:00                 30                   0
P1             29        4/17/2020 0:00              10                   30
P1             29        4/17/2020 0:00              20                   40
P1             29        5/12/2020 0:00              70                   60
P1             29       5/12/2020 0:00              110                 130   


Kindly let me know the how the "Output Measure/Column" has to be calculated on the baseic of the QTY Cumulative sum

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

Hi @Anonymous ,

 

We can create an index column and a calculate column to meet your requirement.

 

1. In Power Query Editor, we can add an index column using index column function.

 

Create 1.jpg

 

2. Then we can create a calculate column to get the result.

 

Output = 
var x = CALCULATE(SUM('Table'[BO_QTY]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
return 
IF(ISBLANK(x),0,x)

 

Create 2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.       

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create an index column and a calculate column to meet your requirement.

 

1. In Power Query Editor, we can add an index column using index column function.

 

Create 1.jpg

 

2. Then we can create a calculate column to get the result.

 

Output = 
var x = CALCULATE(SUM('Table'[BO_QTY]),FILTER('Table','Table'[Index]<EARLIER('Table'[Index])))
return 
IF(ISBLANK(x),0,x)

 

Create 2.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

BTW, pbix as attached.       

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.