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
KoalaPBI
Frequent Visitor

limit x axis on a line chart till 3 months ago

Hi there,

 

In the following line chart, how can I limit x axis till 3 months ago from the current month:  that is Aug FY23 (FY is from 1st July to 30th June) being the current month, I want to show the x axis till May FY22 only.

KoalaPBI_0-1660864933436.png

 

Thanks for your help.

1 ACCEPTED SOLUTION

Hi @KoalaPBI.

Try below as a calculated column in your dates table if you have one otherwise in your facts table. This will return TRUE/FALSE. You can then use this column to filter your visual.

Within 3 months = 
VAR CurrentMonthStart =
    EOMONTH ( TODAY (), -1 ) + 1 //get the start of the month
VAR ThreeMonthsAgo =
    EDATE ( CurrentMonthStart, -3 ) //3 months earlier from the start of the month
RETURN
    Dates[Date] >= ThreeMonthsAgo

 

Try below as a measure.

Value within 3 mos = 
VAR CurrentMonthStart =
    EOMONTH ( TODAY (), -1 ) + 1 //get the start of the current month
VAR ThreeMonthsAgo =
    EDATE ( CurrentMonthStart, -3 ) //3 months earlier start of the current month
RETURN
    CALCULATE ( [original measure], FILTER ( Dates, Dates[Date] >= ThreeMonthsAgo ) )

 

Take note TODAY will update in your next dataset refresh.

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

6 REPLIES 6
OzkanDhont
Resolver II
Resolver II

Hi @KoalaPBI !


I can think of two options:

1/ You select the visual and filter relative date last three months.

2/ Adapt the measure to only show the values of the last three months.

 

Could you try the first option and let us know if that did the trick?

 

Hope it helped!

 

Kind regards,

OD

@OzkanDhont thanks, the first option doesn't work..

Hi,

You should create a Calendar Table and follow @OzkanDhont first suggestion.  It will work.


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

Hi @KoalaPBI ,

 

What does  your current month mean  here? Is it the actual calendar month as of today or based on a slicer selection?










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

@danextian current month is the actual calendar month as of today. There is no date slicer. 

Hi @KoalaPBI.

Try below as a calculated column in your dates table if you have one otherwise in your facts table. This will return TRUE/FALSE. You can then use this column to filter your visual.

Within 3 months = 
VAR CurrentMonthStart =
    EOMONTH ( TODAY (), -1 ) + 1 //get the start of the month
VAR ThreeMonthsAgo =
    EDATE ( CurrentMonthStart, -3 ) //3 months earlier from the start of the month
RETURN
    Dates[Date] >= ThreeMonthsAgo

 

Try below as a measure.

Value within 3 mos = 
VAR CurrentMonthStart =
    EOMONTH ( TODAY (), -1 ) + 1 //get the start of the current month
VAR ThreeMonthsAgo =
    EDATE ( CurrentMonthStart, -3 ) //3 months earlier start of the current month
RETURN
    CALCULATE ( [original measure], FILTER ( Dates, Dates[Date] >= ThreeMonthsAgo ) )

 

Take note TODAY will update in your next dataset refresh.

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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.