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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
powerbiexpert22
Post Prodigy
Post Prodigy

Default YTD

i want to display YTD months and year  ( from jan 2024 until jul 2024) on x axis in line chart by default if there are no selections made on date range slicer 

if there are any selections made on date slicer then month on x axis should disply based on selections 

 

pbix : https://drive.google.com/file/d/1Bh7Lm1xUbIVmIp-RH2Z_-oPPSSDDhGWw/view?usp=drive_link

 

powerbiexpert22_0-1721237087126.png

 

1 ACCEPTED SOLUTION

@LeandroDeodato Thanks for your contribution on this thread.

Hi @powerbiexpert22 ,

You can follow the steps below to get it, please find the details in the attachment.

1. Create a measure as below 

IsSlicerFiltered = 
VAR _year =
    SELECTEDVALUE ( 'Date'[Year] )
VAR _month =
    SELECTEDVALUE ( 'Date'[MonthNo] )
RETURN
    IF (
        ISFILTERED ( 'Date'[Date] ),
        1,
        IF (
            _year = YEAR ( TODAY () )
                && _month >= 1
                && _month <= MONTH ( TODAY () ),
            1,
            0
        )
    )

2. Apply the visual-level filter with the condition(IsSlicerFiltered is 1) on the line chart

vyiruanmsft_0-1721294539497.png

Best Regards

Community Support Team _ Rena
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

6 REPLIES 6
powerbiexpert22
Post Prodigy
Post Prodigy

i am able to acheive it by creating calculated column, the problem is it is very difficult for user to navigate from year 9999 using calendar as shown in last screenshot

powerbiexpert22_1-1721271089129.png

 

powerbiexpert22_2-1721271127105.png

powerbiexpert22_4-1721271889264.png

 

powerbiexpert22_5-1721272038205.png

 

 

@LeandroDeodato Thanks for your contribution on this thread.

Hi @powerbiexpert22 ,

You can follow the steps below to get it, please find the details in the attachment.

1. Create a measure as below 

IsSlicerFiltered = 
VAR _year =
    SELECTEDVALUE ( 'Date'[Year] )
VAR _month =
    SELECTEDVALUE ( 'Date'[MonthNo] )
RETURN
    IF (
        ISFILTERED ( 'Date'[Date] ),
        1,
        IF (
            _year = YEAR ( TODAY () )
                && _month >= 1
                && _month <= MONTH ( TODAY () ),
            1,
            0
        )
    )

2. Apply the visual-level filter with the condition(IsSlicerFiltered is 1) on the line chart

vyiruanmsft_0-1721294539497.png

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

yes, this is great solution, thanks @v-yiruan-msft 

Great solution!

powerbiexpert22
Post Prodigy
Post Prodigy

Hi @LeandroDeodato ,

can you share more details, i tried to create measure however i need to display dimension values for month on x axis however measure returns only single value

 

LeandroDeodato
Resolver II
Resolver II

 try use HASONEVALUE in the mensure, if has one value selected in field month or year, your mensure apoint to selected value, else show both values.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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