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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
nagarjunakan
Helper I
Helper I

undefined

nagarjunakan_0-1614614710023.png

Hi Team ,

How to do this kind of slicers  please help me.

Thanks in Advance 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @nagarjunakan ,

 

I didn't find the visual, but I made two slicers to achieve the effect you want.

 

1.Create a calendar table and there's no relationship between the calendar table and the main table.

Calendar = CALENDAR(MIN('MainTable'[Date]),TODAY())

1.png

 

2.Create a table with categories by entering data.

2.png

 

3.Create the measure.

FilteredValue =
VAR nocustom =
    SWITCH (
        SELECTEDVALUE ( 'Table (2)'[Category] ),
        "Last 7 days",
            CALCULATE (
                SUM ( MainTable[Value] ),
                DATESINPERIOD ( 'MainTable'[Date], TODAY (), -7, DAY )
            ),
        "Last 14 days",
            CALCULATE (
                SUM ( MainTable[Value] ),
                DATESINPERIOD ( 'MainTable'[Date], TODAY (), -14, DAY )
            ),
        "Last 31 days",
            CALCULATE (
                SUM ( MainTable[Value] ),
                DATESINPERIOD ( 'MainTable'[Date], TODAY (), -31, DAY )
            )
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table (2)'[Category] ) = "Custom",
        CALCULATE (
            SUM ( MainTable[Value] ),
            FILTER (
                'MainTable',
                [Date] >= MIN ( 'Calendar'[Date] )
                    && [Date] <= MAX ( 'Calendar'[Date] )
            )
        ),
        nocustom
    )

 

3.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @nagarjunakan ,

 

I didn't find the visual, but I made two slicers to achieve the effect you want.

 

1.Create a calendar table and there's no relationship between the calendar table and the main table.

Calendar = CALENDAR(MIN('MainTable'[Date]),TODAY())

1.png

 

2.Create a table with categories by entering data.

2.png

 

3.Create the measure.

FilteredValue =
VAR nocustom =
    SWITCH (
        SELECTEDVALUE ( 'Table (2)'[Category] ),
        "Last 7 days",
            CALCULATE (
                SUM ( MainTable[Value] ),
                DATESINPERIOD ( 'MainTable'[Date], TODAY (), -7, DAY )
            ),
        "Last 14 days",
            CALCULATE (
                SUM ( MainTable[Value] ),
                DATESINPERIOD ( 'MainTable'[Date], TODAY (), -14, DAY )
            ),
        "Last 31 days",
            CALCULATE (
                SUM ( MainTable[Value] ),
                DATESINPERIOD ( 'MainTable'[Date], TODAY (), -31, DAY )
            )
    )
RETURN
    IF (
        SELECTEDVALUE ( 'Table (2)'[Category] ) = "Custom",
        CALCULATE (
            SUM ( MainTable[Value] ),
            FILTER (
                'MainTable',
                [Date] >= MIN ( 'Calendar'[Date] )
                    && [Date] <= MAX ( 'Calendar'[Date] )
            )
        ),
        nocustom
    )

 

3.png

 

You can check more details from here.

 

 

Best Regards,

Stephen Tao

 

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

vanessafvg
Super User
Super User

what is the context to this?  you have given very little information here if you use the filtering capability in power bi you should be able to do achieve this

 

see here for more information, and if you have a specific issue that you are struggling with please provide more information.

 

https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-report-filter-types





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi Vaness,

Thanks for ur help,

Actually i need start date and start time, End date and End Time in one slicer i need this kind of Format in one visual

amitchandak
Super User
Super User

@nagarjunakan , refer if this blog can help

https://community.powerbi.com/t5/Desktop/Required-custom-date-Slicer-Last-7-days-last-15-days-last-3...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors