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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
BIUser2024
Regular Visitor

Limiting dates in Line and Stacked Column Chart

I have a line and stacked column chart and i'm trying to show the previous 5 months by month end date on the left side of the x-axis (the blue box on my screenshot) and on the right side of the x-axis, I want to only show yesterday's date (the red box).  I have my SQL query to allow for this but when I put the date column into the chart, it returns every day of my current month (the green box) BUT it does show previous 5 months by month end date.

 

Does anyone know if it's possible to get rid of the dates in the current month (the green box)?

 

BIUser2024_0-1714076001475.png

 

 

Thank you!

1 REPLY 1
Anonymous
Not applicable

Hi @BIUser2024 ,

I don't know how you created that visual object, so I may not be able to give you a solution based on what you have first. But I can provide you with a workaround.
Here is my sample data:

vjunyantmsft_0-1714097739003.png


And I add a Table X-axis for the x-axis of the visual:

vjunyantmsft_3-1714098238923.png


Use these DAXs to create measures to calculate the previous 5 month and yesterday:

Yesterday = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = TODAY() - 1
)
previous month_1 = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = EOMONTH(TODAY(), -1)
)
previous month_2 = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = EOMONTH(TODAY(), -2)
)
previous month_3 = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = EOMONTH(TODAY(), -3)
)
previous month_4 = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = EOMONTH(TODAY(), -4)
)
previous month_5 = 
CALCULATE(
    SUM('Table'[Value]),
    'Table'[Date] = EOMONTH(TODAY(), -5)
)


And use this DAX to create a measure for the Y-axis of the visual:

Y-axis = 
SWITCH(
    TRUE(),
    SELECTEDVALUE('X-axis'[X-axis]) = "previous 5 month", [previous month_5],
    SELECTEDVALUE('X-axis'[X-axis]) = "previous 4 month", [previous month_4],
    SELECTEDVALUE('X-axis'[X-axis]) = "previous 3 month", [previous month_3],
    SELECTEDVALUE('X-axis'[X-axis]) = "previous 2 month", [previous month_2],
    SELECTEDVALUE('X-axis'[X-axis]) = "previous 1 month", [previous month_1],
    SELECTEDVALUE('X-axis'[X-axis]) = "Yesterday", [Yesterday]
)


Then build the visual like this and the final output is as below:

vjunyantmsft_5-1714098305402.png

 

If this solution does not solve your problem, could you please provide a bit of detail about how you created the visual object, such as the code you used and which fields were placed where in the visual object?

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.