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
PowerStone
New Member

Measure for start of month value to equal previous month ending value

Hello, 
 
I'm having some trouble with what should be an easy measure to make the beginning month QTY equal the previous month ending QTY.  I've tried a bunch of different ways and the QTY I'm returning is always the current month value, not the previous month. 
 
Here's some sample data:
DateYearMonth NumMonthBegin AMTBegin AMT 2Begin AMT 3QTY SoldQTY ReceivedQTY IssuedQTY TransferQTY AdjustedEnd Amt
1/1/201620161Jan5,3115,3115,311-1,3823,936 -4253,1825,311
2/1/201620162Feb-2,353-2,353-2,353-1,379  -974 -2,353
3/1/201620163Mar3,2423,2423,242-1,5584,800 -4824823,242
4/1/201620164Apr-2,762-2,762-2,762-1,293  -605-864-2,762
5/1/201620165May17,60417,60417,604-2,0107,200 -1,20713,62117,604
6/1/201620166Jun-3,244-3,244-3,244-2,020  -1,224 -3,244
 
The beginning QTY for February should be 5,311 and instead I'm pulling in the current month end QTY.  
 
Here are the 3 measures I'm using:
 
Begin AMT = CALCULATE([End Amount],PREVIOUSMONTH(tblCALENDAR[Date]))
 
Begin AMT 2 = CALCULATE([End Amount], DATEADD(tblCALENDAR[Date], -1, MONTH))
 
Begin AMT 3 = 
VAR DaysInterv = DATEDIFF(MIN(tblCALENDAR[Date]),MAX(tblCALENDAR[Date]),DAY)
RETURN
CALCULATE([End Amount],DATESINPERIOD(tblCALENDAR[Date],MIN(tblCALENDAR[Date]) - 1,DaysInterv,MONTH))
 
Any help would be greatly appreciated.  Thanks!
1 REPLY 1
Greg_Deckler
Super User
Super User

@PowerStone You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors