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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Slicer 7 months prior

Hi,

 

Is it possible to display the previous 7 months data in my matrix like in the image?

 

This needs to be done when one month is selected in the reporting period slicer, but to look back 7 months?

 

Ive attached an image with how I'd like it to look, but obviosuly that's only obtained from highlighting 7 options.

 

Slicer.png

 

Any help would be appreciated

 

Thanks

 

Liam

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

See if my solution here helps - Flex a Pivot Table to show data for x months ended a certain user defined month.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

Replace the -[N value] with -6

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

15 REPLIES 15
Ashish_Mathur
Super User
Super User

Hi,

See if my solution here helps - Flex a Pivot Table to show data for x months ended a certain user defined month.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Ashish_Mathur ,

 

That is what I'm after but I'm not quite sure how I would translate that to Power BI?

 

Thanks

 

Liam

Hi,

The same formulas/methodology/process will work in PowerBI Desktop as well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Ashish_Mathur ,

 

I have limited functionality on the file that you have shared.

 

I have created the same tables with info. Could you please confirm any relationships that exist?

 

Thanks

Hi,

See this

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thanks for your help with this @Ashish_Mathur  @v-shex-msft 

 

I have managed to get it to work off of a parameter like in the image.

 

Is there any way that I can have it automatically set at 6 months with no need for filters? So once E.g. in the image 2020-01 is set then it automatically shows the previous 6 ?

 

My values code currently is:

 

Sales (last n months) =
CALCULATE (
AVERAGE( vwSnapShotSummary[Value] ),
DATESINPERIOD ( 'Date'[Date],MAX('Date'[Date]), - [N Value],MONTH)
)

 

 

 

 

Slicer.png

 

Thanks

 

Liam

Hi,

Replace the -[N value] with -6

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thankyou so much for your help with that @Ashish_Mathur 

 

All sorted!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur  

 

One last thing - On top of the previous 6 months, how would the future 6 months be inserted into the same query?

 

Thanks in advance

 

Liam

You will have to write another formula in which you will replace -6 with 6.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Ashish_Mathur 

 

TableData =
CALCULATE (
AVERAGE( vwSnapShotSummary[Value] ),
DATESINPERIOD ( 'Date'[Date],MAX('Date'[Date]), -6,MONTH),
DATESINPERIOD ( 'Date'[Date],MAX('Date'[Date]), 6,MONTH))
 
 
This displays blank now. Is that how you meant?
 
Thanks

No.  That is not what i said.  I said you will have to write another formula.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

@Ashish_Mathur 

 

Okay, well that won't work as it needs to be in the same measure.

v-shex-msft
Community Support
Community Support

Hi @Anonymous,

You can extract date field records to create a new table as the source of the slicer. (this table does not have a relationship to original table) Then you can write a measure formula to replace the original value field. (compare current table date and the selected date and replace unmatched records to blank so that matrix visual will auto-hide them)

If you confused about coding formula, please share some dummy data to test.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.