Forum Discussion

nagarjunakan's avatar
nagarjunakan
Helper I
5 years ago
Solved

undefined

Hi Team , How to do this kind of slicers  please help me. Thanks in Advance 
  • Anonymous's avatar
    Anonymous
    5 years ago

    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())

     

    2.Create a table with categories by entering data.

     

    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
        )

     

     

    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.