Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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

Greg_Deckler 

  • Anonymous's avatar
    Anonymous
    4 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

  • Read about the new "Field Parameters" feature. It works for columns and measures.

    • Anonymous's avatar
      Anonymous
      Not 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's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity 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.

    • Anonymous's avatar
      Anonymous
      Not 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.