Forum Discussion
Calculated table based on selection
- 1 year ago
Hey!
As my fellow uses stated, calculated tables and -columns are generated at the refresh and therefore will not react in the manner that you want.
To get the results you want, create a seperated datetable. and connect it to your data.Datetabel = ADDCOLUMNS ( CALENDAR (DATE(2024,1,1), DATE(2025,12,31)), "DateAsInteger", FORMAT ( [Date], "YYYYMMDD" ), "Year", YEAR ( [Date] ), "Monthnumber", FORMAT ( [Date], "MM" ), "MonthShort", FORMAT ( [Date], "mmm" ), "MonthLong", FORMAT ( [Date], "mmmm" ), "YearMonthNo", FORMAT ( [Date], "YYYY/MM" ), "YearMonthShort", FORMAT ( [Date], "YYYY/mmm" ), )you can now use a slicer on the Year column of the date table to filter only years you want.
No Date column in Data?
If you don't have a date column in your data, you can also create a seperate table that contains the years and use that as a slicer.
You can create a slicer table with both Power Query (preferred) and DAX
Power Query:let Source = Table.FromList({2023, 2024, 2025}, Splitter.SplitByNothing(), {"Period"}, null, ExtraValues.Error), ChangeType = Table.TransformColumnTypes(Source,{{"Period", Int64.Type}}) in ChangeType
DAX Tabel:Period = SUMMARIZE(YOURDATA, YOURDATA[Period])
Result:If this solution helped solve your problem, please consider giving kudoes and mark it as a solution, so other users with similar problems can find the answer more quickly!
You cannot create calculated column or calculated tables from measures or user interaction (filters). Only works the other way round.