Forum Discussion
Filter interaction matrix charts
See below: I selected the category Spare parts.
In the chart it only shows 2019 and 2020. I have data for before and after.
If I deselect the category, 2018 to 2022 are displayed.
You still have the 'Filter' behaviour selected in your screenshot which will not work for what you are trying to achieve. Please change the interaction so that the middle option is selected (Highlight):
Then try your matrix selection again and let us know how this goes.
- MagikJukas4 years ago
Resolver III
as you can see, it evaluates there is nothing outside these periods.
I suspect the solution is to build a formula that ignores the period... I am struggling to figure it out though.
- Whitewater1004 years ago
Solution Sage
Hi:
I can be way off. Do you have separate Date Table which is being used for any date fields in your visuals?
I'll attach a basic file with date table and paste date table code bellow if you need it. The date table must be marked as date table and have relationship with your fact table. This file example will demonstrate this.
https://drive.google.com/file/d/14G9U23xIV9_f57l2M7ChY-KWPif8M3Dp/view?usp=sharing
Date Table MODELING>NEW TABLE > Paste this in..
Dates =
-- Specify a start date and end date
VAR StartDate = Date(2021,1,1)
VAR EndDate = Today() + 243
VAR FiscalMonthEnd = 12
-- Generate a base table of dates
VAR BaseTable = Calendar(StartDate, EndDate)
-- Add the Year for each individual date
VAR Years = ADDCOLUMNS(BaseTable,"Year",YEAR([Date]))
-- Add the calendar month and other month related data for each date
VAR Months = ADDCOLUMNS(
Years,
"Month",MONTH([Date]),
"Year and Month Number",FORMAT([Date],"YYYY-MM"),
"Year and Month Name",FORMAT([Date],"YYYY-MMM"),
"Fiscal Year", IF( FiscalMonthEnd = 12, YEAR([Date]), IF( MONTH([DATE]) <= FiscalMonthEnd, YEAR([DATE])-1, YEAR([Date]))),
"Fiscal Month", IF( FiscalMonthEnd = 12, MONTH([Date]),
IF( MONTH([Date]) <= FiscalMonthEnd, FiscalMonthEnd + MONTH([Date]), MONTH([Date]) - FiscalMonthEnd))
)
-- Add the Quarter and other quarter related data for each date
VAR Quarters = ADDCOLUMNS(
Months,
"Quarter",ROUNDUP(MONTH([Date])/3,0),
"Year and Quarter",[Year] & "-Q" & ROUNDUP(MONTH([Date])/3,0))
-- Add the Day and other day related data for each date
VAR Days = ADDCOLUMNS(
Quarters,
"Day",DAY([Date]),
"Day Name",FORMAT([Date],"DDDD"),
"Day Of Week",WEEKDAY([Date]),
"Day Of Year", DATEDIFF (DATE(YEAR([Date]),1,1), [Date], DAY) + 1)
-- Add the Week (assuming each week starts on a Sunday) and other week related data for each date
VAR Weeks = ADDCOLUMNS(
Days,
"Week Of Month (Sunday)",INT((DAY([Date])-1)/7)+1,
"Week of Year (Sunday)",WEEKNUM([Date],1),
"Year and Week (Sunday)",[Year] & "-W" & WEEKNUM([Date],1))
-- Add an 'Is Working Day' column which will be true for all days but Saturday and Sunday.
var WorkingDays = ADDCOLUMNS(
Weeks,
"Is Working Day", NOT WEEKDAY( [Date] ) IN {1,7})
RETURN WorkingDays
- BITomS4 years ago
Solution Supplier
Apologies, I must have misunderstood your original post, because your last screenshot looks like what I thought you were requesting (selecting a single category, but the chart still showing all data for all years). I've now caught onto the fact you only want 'Spare Parts' for all years in the chart.
In terms of a formula, it looks like Whitewater100 has suggested something, but I would question why you need to introduce complex formula logic (However, I don't understand your use case). For instance, you could add a slicer on the canvas for 'category', which updates both the matrix and chart to achieve what you need. Or you could change the visual vilter on the matrix from using the date, to where values are 'not blank', so no years are obfuscated, and then user selection on the matrix will not limit the chart.
Like I say, I don't understand your use case, so the above suggestions may not work, but thought it may be worth calling out the alternative design options to effectively achieve the result.