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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Drake023
Regular Visitor

Change of dates with slicer selection

Hi Guys,

 

Here is my problem.

I have a line graph with last 6 months data which is default, now when I select July automaticall the line graph should show past 6 months from July, simillary if I select May the graph automatically move to 6 months past from may. I should not consider the month I selected in the graph only the past 6 months from the month I selected.

 

 

Thanks in advance.

3 REPLIES 3
Fowmy
Super User
Super User

@Drake023 

Make a copy of your dates table and don't create any relationship to it, make sure your have Month-Year Column, you create like 

Month Year = FORMAT('DATE'[Date], "Mmm YYYY")

 
Place that Month Year Field on a slicer for the user to choose, create the measure as

 

Past 6 Months = 
VAR _D = EDATE(MIN('Dates2'[Date]),-6) return
IF( 
    MAX('DATE'[Date]) < _D ||  MAX('DATE'[Date]) > MIN('Dates2'[Date]),
    BLANK(),
    [Total Sales]
)

 


I selected Jan 2017, the chart shows the past 6 months

 

Screenshot 2020-09-23 113902.png

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@Drake023 , Create a column like this in you date table and use that as filter

 

Month Type = Switch( True(),
eomonth([Date],0) <= eomonth(Today(),0) && eomonth([Date],0) >= eomonth(Today(),-6),"Last 6 Month" ,
Format([Date],"MMM-YYYY")
)

 This may not work as today is considered.I want last 6 months based on user selection year and month.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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