Forum Discussion
How to Categorize Dates based on Relative Date Slicer
- Anonymous3 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 _ RongtieIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
So this worked in categorizing the dates, but since its a measure, I cant create any sort of groupings from it. Ultimately, I want to sum metrics using this category. Example:
Total Revenue
Selected Period: $5,000
Same Period Last Year: $7,000
I may be oversimplifying, but is there an easy way to convert the measure to a column so I can create visuals from this grouping?