cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Previous month and Current month values are same

I'm building a report, the matrix should show current and previous month figures. When i tried both current and previous columns show same values.

 

power1.PNG

 

I have tried multiple ways for the calculated previous month column using DAX as shown below by refering to multiple posts

 

Previous Active = VAR prevMonth =MONTH(TODAY()) - 1 RETURN CALCULATE(
	SUM(ViewClashDetection[Active]),
	FILTER(ALL(DimDate[Month]), VALUE(DimDate[Month]) = prevMonth)
)

Previous Active= VAR prevMonth = DATESINPERIOD(DimDate[Date],TODAY(),-2,MONTH) RETURN CALCULATE(
	SUM(ViewClashDetection[Active]),
	DATESBETWEEN(DimDate[Date],[Measure 5],[Measure 4])
)

Previous Active = CALCULATE(
	SUM(ViewClashDetection[Active]),
	DATEADD(DimDate[Date], -1, MONTH)
)

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Previous month and Current month values are same

Hi @prvn ,

Based on my test, you could refer to below formula:

Measure = CALCULATE(SUM(Table1[Active]),PREVIOUSMONTH('Calender'[Date]))

Result(note to use calender date as date):

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Highlighted
Microsoft
Microsoft

Re: Previous month and Current month values are same

Hi @prvn ,

Based on my test, you could refer to below formula:

Measure = CALCULATE(SUM(Table1[Active]),PREVIOUSMONTH('Calender'[Date]))

Result(note to use calender date as date):

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Frequent Visitor

Re: Previous month and Current month values are same

Thanks for the respose. Will this solution work if there is data missing for weeks in between?

I was unable to open the pbix as i need to update power bi app. I'm currently using 2.67.

Highlighted
Microsoft
Microsoft

Re: Previous month and Current month values are same

Hi @prvn ,

Yes, it could work for your data. You could also refer to below link about how to use previousmonth function:https://docs.microsoft.com/en-us/dax/previousmonth-function-dax

If it could not help you, you could upload your pbix file to have a test.

 

Regards

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Microsoft
Microsoft

Re: Previous month and Current month values are same

Hi @prvn ,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered to close this topic?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors