Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
VisheshVats
Helper I
Helper I

Slice/Filter visual with measure

Hey Guys,

 

Capture1.PNGCapture2.PNG

 

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 

1 ACCEPTED SOLUTION

Hi Greg thanks for the reply, I worked around a bit and got it work. This is my measure selecting values from both slicers.

Capture1.PNGCapture2.PNG

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

@VisheshVats 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.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi Greg thanks for the reply, I worked around a bit and got it work. This is my measure selecting values from both slicers.

Capture1.PNGCapture2.PNG

lbendlin
Super User
Super User

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

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.