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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
randika118
Helper I
Helper I

Line Chart dynamic X-Axis based on Month and Year Slicers

Hi All,

I have a line chart and I want to add a dynamic

Img.png

"date range" x-axis so, Start Date should be based on the column Max Value and End Date Should be Based selected Slicer Value

So, I tried to change the "Range" of X-Axis in Line Chart Properties. 
Start Date Ok. but for the End Date, I calculated the date measure based on the slicers, but it didn't work out.

can you help?


 

Thanks,

 

1 ACCEPTED SOLUTION

Hi , @randika118 

I think the @amitchandak  Dax code is right .

I test it in my side ,this is my test data:

vyueyunzhmsft_0-1683179606458.png

We need to put the 'Calendar'[Date].[Year] and [Month] on the slicer and we use this Measure:

Measure = 
var _slicer = maxx(allselected('Calendrier'), 'Calendrier'[Date])
return
_slicer

 

And we configure it in the X-axis:

vyueyunzhmsft_1-1683179671550.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

View solution in original post

5 REPLIES 5
randika118
Helper I
Helper I

It doesn't work out

Hi , @randika118 

I think the @amitchandak  Dax code is right .

I test it in my side ,this is my test data:

vyueyunzhmsft_0-1683179606458.png

We need to put the 'Calendar'[Date].[Year] and [Month] on the slicer and we use this Measure:

Measure = 
var _slicer = maxx(allselected('Calendrier'), 'Calendrier'[Date])
return
_slicer

 

And we configure it in the X-axis:

vyueyunzhmsft_1-1683179671550.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Thank you. It works. 

amitchandak
Super User
Super User

@randika118 , Have you tried a measure like ?

 

maxx(allselected(Date), Date[Date])

Hi. No, i will try. 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors