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
arvindyadav
Post Partisan
Post Partisan

How to extract previous months week value and current months 1st week value

Hi Team,

 

I am struggling with some query i.e

I want to compare previous months date like 1st January 2018 to 8th January 2018 from 1st January 2018 to 8th January 2018 sale difference in percentage.

 

i.e, basically I want date to date comparison of my sales in the field.

i.e, Suppose  I incur 2lakhs in 1st January 2018 and 5 Lakhs in 1st February 2018  what is % change between this date.

So how to extract dates from date column and compare this please explain.

Thanking You!!!

 

 

Regards,

Arvind.

1 ACCEPTED SOLUTION

@arvindyadav,

 

Try this,

 

Variance% =

VAR __PREV_MONTH = CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))
RETURN
DIVIDE(SUM('Sales'[Value]) - __PREV_MONTH, __PREV_MONTH)

 

 

View solution in original post

10 REPLIES 10
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @arvindyadav,

For Month to Month Percent Change, please see an example in this blog: Measures – Month to Month Percent Change.

Best Regards,
Angelia

Hi @angelia,

 

The link that you shared it is not working. Please, can you suggest any dax for the same?

 

Regards, 

Arvind

@arvindyadav,

 

Try this,

 

Variance% =

VAR __PREV_MONTH = CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))
RETURN
DIVIDE(SUM('Sales'[Value]) - __PREV_MONTH, __PREV_MONTH)

 

 

Hi @SivaMani,

 

In your case can you please suggest me how to first find previous month value and then I will apply the Dax formula that was you provided to me.

 

Regards,

Arvind.

CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))

Hi @SivaMani,

 

The formula given by you for the previous month is not working.

Please find attached file.

 

Regards,

Arvind.CAN'T SEE THE VISUAL.png

Thanks @SivaMani .

Hi @SivaMani,

 

Got answer thank you so much.

Last doubt how you got _PREV_MONTH in this formula.

Variance% =

VAR __PREV_MONTH = CALCULATE(SUM('Sales'[Value]), DATEADD('Sales'[Date], -1, MONTH))
RETURN
DIVIDE(SUM('Sales'[Value]) - __PREV_MONTH, __PREV_MONTH)

 

Regards,

Arvind

CALCULATE has two parts,

  1. Expression
  2. Filters

The expression will be evaluated based on the filters. In this case, DATEADD will give me previous month date. So, CALCULATE will give me the value of the previous month.

 

That's how it works.

 

It's working fine for me.

 

Can you share the error details?

 

If possible, share the pbix as well.

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!

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.

Top Solution Authors
Top Kudoed Authors