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
aryaps
Frequent Visitor

Dax for Cumulative & previous Cumulative Values

Hello

How can we get the 4 Highlighted column result in BI with Dax

Purchase=  Purchase Recpt & Postive Adjustment
sale =  Sale & Negative Adjustments

 

Entry No.Posting DateEntry TypeDocument TypeItem No.QuantitySales Amount (Actual)Cost Amount (Actual)Cumulative PurcahsePreviou cumulataive PurchaseCumlative SalePrevious Cumulative Sale
170001/01/2022PurchasePurchase ReceiptMbl20 20020   
170101/01/2022Postive Adjsmt Mbl5 5025   
170202/01/2022PurchasePurchase ReceiptCharger100 1000100   
170302/01/2022Negative Adjsmt Mbl-5100     
170402/01/2022PurchasePurchase ReceiptMbl10 15035   
170502/01/2022SaleSaleMbl-10200     
            
 

 

          
3 REPLIES 3
aryaps
Frequent Visitor

anyone pls help on this

amitchandak
Super User
Super User

@aryaps , You can have cumulative measure like

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])))

or

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date])))

 

or a day behind

 

 

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])-1 ))

or

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(allselected(date),date[date] <=max(date[Date]) -1 ))

 

month behind

 

 

Cumm Sales =

var _max =  max('Date'[date])

var _last = date(year(_max) , month(_max)-1, day(_max) )

return

CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=_last ))

 

Running Total/ Cumulative: https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=41

 

 

You can also consider window function

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

 

 

Thanks for the Reply

So in My case how it will , bcz Purchase=  Purchase Recpt & Postive Adjustment AND sale =  Sale & Negative Adjustments. apart from this, per day if multiple sale or purchase also happend so how it will come.

 

Note: only Entry number is different for all transactions, (Cant give index number or no time stamp available on posting date)

 

 

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.