Forum Discussion
Slice/Filter visual with measure
Hey Guys,
As you can see I have managed to create a measure that can slice the visual based on the selection i make on the Select Index slicer.
Firstly, as you can see from my measure, the alternate result is Blank(), what can i do so that if nothing is selected, all the indexes are selected and the graph shows all the lines together.
Secondly, What i seek to achive further is to create a measure that will slice the x-axis(date) based on the selected value in the select period slicer. Like it should show date range only for 1 month back from today if i select 1 Month and so on.
Thanks in advance
- Anonymous4 years ago
Hi Greg thanks for the reply, I worked around a bit and got it work. This is my measure selecting values from both slicers.
4 Replies
- lbendlin
Super User
Read about the new "Field Parameters" feature. It works for columns and measures.
- AnonymousNot applicable
Thanks, It seems like a much awaited feature from MS, but somehow it doesnt quite work with charts and graphs, works well with tables. Or maybe I'm missing something.
- Greg_Deckler
Community Champion
Anonymous So, for the first item, I would break that measure into 6 measures, one for each index and basically if switch your logic from HASONEVALUE to an IN statement where the table portion of the IN statement comes from grabbing all of the selected values in the slicer. The NASDAQ measure returns the calculation if it is IN the selected values, otherwise it return BLANK.
You can do something similar with your date filter. Let's say 1 month for example:
Measure = VAR __Today = TODAY() VAR __MontStart = DATE(YEAR(__Today), MONTH(__Today), 1) VAR __Date = MAX('Table'[Date]) RETURN IF( __Date <= __MonthStart, ... //calculation, BLANK() )You could simply add this into a SWITCH TRUE statment logical condition using && operator.
- AnonymousNot applicable
Hi Greg thanks for the reply, I worked around a bit and got it work. This is my measure selecting values from both slicers.