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

Previousmonth

Hi guys!

 

I'm having trouble understanding how previousmonth works with slicers.

 

As you can see on the pictures below, it shows "Em branco" ("Blank" in portuguese) when I filter by segmentation, but when I filter clicking on the matrix, it shows the right value. Does someone knows why this is happening and how I can fix it? 


Picture 1 - No filter appliedPicture 1 - No filter appliedPicture 2 - Filtered by segmentationPicture 2 - Filtered by segmentationPicture 3 - Filtered by the matrixPicture 3 - Filtered by the matrix

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Memorable Member
Memorable Member

Re: Previousmonth

Hello @nicoams 

 

My understanding is that in the slicer you have used Month in text format. And in your calendar you will have multiple values for Jan, Feb, etc. When you are selecting Apr from the slicer, the return table will give apr of 2019 & 2020 as well, but for PREVIOUSMONTH, it requires one date as an input.

 

Same is not happening when you are selecting it from the table visual, as you have year included in the visual. When you select Apr in the table visual, it is essentially selecting Apr of 2020, hence you are getting the result.

 

May I suggest

  • either you use an additional slicer for Year along with Month, or add Year in the slicer
  • or you can use a month(in date format) in the slicer

 

Cheers!

Vivek


If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)

If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)

https://www.vivran.in/

Connect on LinkedIn
Follow on Twitter



 

 

View solution in original post

4 REPLIES 4
Highlighted
Super User IV
Super User IV

Re: Previousmonth

@nicoams , I am not able to get what is wrong here. As you are taking Month year from the calendar , the correct context of the month has been taken and previous value us shown. Your filter of the month will only work on dimensions other than the date.

So if you view by say city then you will only see April vs March if you have selected April.

 

Other option to explore with date calendar

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
last QTR same Month (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,Qtr))))
MTD (Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR('Date'[Date])))
MTD (Last Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR(dateadd('Date'[Date],-12,MONTH),"8/31")))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))


Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
My Recent Blog -Week is not so Weak Connect on Linkedin

Proud to be a Super User!

Highlighted
Memorable Member
Memorable Member

Re: Previousmonth

Hello @nicoams 

 

My understanding is that in the slicer you have used Month in text format. And in your calendar you will have multiple values for Jan, Feb, etc. When you are selecting Apr from the slicer, the return table will give apr of 2019 & 2020 as well, but for PREVIOUSMONTH, it requires one date as an input.

 

Same is not happening when you are selecting it from the table visual, as you have year included in the visual. When you select Apr in the table visual, it is essentially selecting Apr of 2020, hence you are getting the result.

 

May I suggest

  • either you use an additional slicer for Year along with Month, or add Year in the slicer
  • or you can use a month(in date format) in the slicer

 

Cheers!

Vivek


If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)

If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)

https://www.vivran.in/

Connect on LinkedIn
Follow on Twitter



 

 

View solution in original post

Highlighted
Frequent Visitor

Re: Previousmonth

Hi there. 

You were right. I was leaving out the year. Thank you for your patience. 😄

Best regards.

Highlighted
Frequent Visitor

Re: Previousmonth

Hi there.

The problem was I was filtering the month, but the data has more than one year, so the lack of this information made it not show what I wanted.

Thank you very much for your reply and the options (mindblowing, I didn't knew there were so many ways to do it), I will save it to study them later. 

Best regards.

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

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

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors