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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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...


Follow on LinkedIn
@ 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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors