Forum Discussion

Bjar2023's avatar
Bjar2023
New Member
3 years ago
Solved

How to Categorize Dates based on Relative Date Slicer

I have a report with a relative date slicer.  Example:    I have created formulas for the min and max of those dates.  Example: Min Display Date = CALCULATE ( Min( 'Date Table'[Date] ), ALL...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Bjar2023 ,

    Please have a try.

    Create a table.

    Period = {"Same Period last year","Selected Period"}

    Then create a measure.

    PeriodValue =
    VAR _a =
        ALLSELECTED ( 'Date'[Date] )
    VAR _b =
        SELECTCOLUMNS ( _a, "Last Year", EDATE ( [Date], -12 ) )
    RETURN
        SUMX (
            'Period',
            SWITCH (
                [Period],
                "Selected Period", SUMX ( FILTER ( 'Table', [date] IN _a ), [value] ),
                "Same Period last year", SUMX ( FILTER ( 'Table', [date] IN _b ), [value] )
            )
        )
    

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

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