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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Instead of previous 2 weeks set previous month define update it mid month

 
Old Data :
 
        Month                   Period                                        closevalue 
          Oct               01 November 2019                                10 
          Nov              15 November 2019                                 5           
          Dec               01 December  2019                                7
          Dec               15 December  2019                               17
          Jan               01 Januray     2020                                  27
           Jan            15 Januray     2020                                    17
 
 i have like this upto 2021 last taking percentage calcualtion last weeks but now changed like below 
 
 
    Month                   Period                                        closevalue 
   November          01 November 2019                             10 
    November         01 November 2019                              5           
   December          01 December  2019                              7
   December          15 December  2019                             17
  January                01 Januray  2020                                27
   January              15 Januray   2020                                 17
 
 
instead of previous  last weeks  i want to change to previous Month to define how update it at  mid month 
 
Previous 2 Weeks =
VAR LastMAXDate = MAX ( Data[Period] )
VAR currentValue =
CALCULATE (
SUM ( Data[Revised closing value] ),
Data[Period] = LastMAXDate
)
Return DIVIDE((currentValue-[LastweekValue]),[LastweekValue])

 

 

 

Measure 2 :

LastweekValue =
VAR maxdate =
CALCULATE ( MAX ( Data[Period] ), ALLSELECTED ( Data ) )
var seconddate =
CALCULATE (
MAX (Data[Period] ),
FILTER ( ALL ( Data ), Data[Period] < maxdate )
)

return
CALCULATE (
SUM ( Data[Revised closing value] ),
Data[Period] = seconddate
)
 
any idea .where to change in my measure ? thanks in advance 
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Why don't you use time intelligence for this, with help from Date table. Is it not working ?

 

example

 

MTD Sales = CALCULATE(SUM ( Data[Revised closing value] ),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM ( Data[Revised closing value] ),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

or

previous month value = CALCULATE(SUM ( Data[Revised closing value] ),previousmonth('Date'[Date]))

 

 

refer if needed

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@amitchandak  thank you brother. will check 

amitchandak
Super User
Super User

@Anonymous , Why don't you use time intelligence for this, with help from Date table. Is it not working ?

 

example

 

MTD Sales = CALCULATE(SUM ( Data[Revised closing value] ),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM ( Data[Revised closing value] ),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

or

previous month value = CALCULATE(SUM ( Data[Revised closing value] ),previousmonth('Date'[Date]))

 

 

refer if needed

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-Last-Week/ba-p/1051123
https://www.youtube.com/watch?v=pnAesWxYgJ8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.