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
Seabok
New Member

How to set date range in one drop down list slicer?

Hi,

 

I have to fillfull the following two conditions:

 

First, It must be a date slicer with drop down list Slicer.jpg

which it must not be a bar slicer as the picture below.

 

 

Slicer2.jpg

 

Second, as the financial year start from April every year, the date shown on the report will be cumulative.

For example, if we select 201805, the report will show the data between 201804 and 201805 and if we select 201902, the report will show the data between 201804 and 201902. 

 

How can I solve this problem?

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Seabok ,

 

One sample for your reference, Please check the following steps as below.

 

1. Create a calculated table.

 

ym = DISTINCT('Table'[Year Month])

2. New two calculated columns in it and format them as whole number.

Month = RIGHT('ym'[Year Month],2)
Year = LEFT('ym'[Year Month],4)

3. Create a measure as below and make the visual filtered by the measure.

Measure = 
VAR ym1 =
    SELECTEDVALUE ( 'ym'[Year Month] )
VAR mon =
    SELECTEDVALUE ( ym[Month] )
VAR year =
    SELECTEDVALUE ( 'ym'[Year] )
RETURN
    IF (
        mon >= 4
            && MAX ( 'Table'[Year Month] ) <= ym1,
        1,
        IF (
            mon < 4
                && MAX ( 'Table'[Year Month] ) <= ym1
                && MAX ( 'Table'[Year Month] ) >= ( ( year - 1 ) * 100 + 4 ),
            1,
            0
        )
    )

Capture.PNG

 

Pbix as attached.

 

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

View solution in original post

1 REPLY 1
v-frfei-msft
Community Support
Community Support

Hi @Seabok ,

 

One sample for your reference, Please check the following steps as below.

 

1. Create a calculated table.

 

ym = DISTINCT('Table'[Year Month])

2. New two calculated columns in it and format them as whole number.

Month = RIGHT('ym'[Year Month],2)
Year = LEFT('ym'[Year Month],4)

3. Create a measure as below and make the visual filtered by the measure.

Measure = 
VAR ym1 =
    SELECTEDVALUE ( 'ym'[Year Month] )
VAR mon =
    SELECTEDVALUE ( ym[Month] )
VAR year =
    SELECTEDVALUE ( 'ym'[Year] )
RETURN
    IF (
        mon >= 4
            && MAX ( 'Table'[Year Month] ) <= ym1,
        1,
        IF (
            mon < 4
                && MAX ( 'Table'[Year Month] ) <= ym1
                && MAX ( 'Table'[Year Month] ) >= ( ( year - 1 ) * 100 + 4 ),
            1,
            0
        )
    )

Capture.PNG

 

Pbix as attached.

 

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

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.