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
Anonymous
Not applicable

Need to create a Measure to place it at visual level filter

Hi Team,

 

Need help to create a measure which i will be using as visual level filter on a Report. 

 

 I have a customer table with customerid, I dont want to create calcualted column but make use of mesaure.

 

Code logic that i would like to have in measure.

 

Customerid not in ('1234',2345',3452',2647',2348')

 

Any help is highly appreciated.

 

Thanks in advance.

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , Try a measure like

calculate(sum(Table[value]) , filter(table, not(Customerid in {"1234","2345","3452","2647","2348"})))

Greg_Deckler
Super User
Super User

@Anonymous - Perhaps:

 

Measure =
  VAR __CustomerID = MAX('Table'[CustomerID])
  VAR __Table = { '1234',2345',3452',2647',2348' }
RETURN
  IF(NOT(__CustomerID IN __Table),1,0)

IDK, I mocked up both in a sample file and both seem to work. You can just filter on the 1 or the 0. See PBIX attached below sig. You want Page 3, Table (3).

 


@ 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...
Anonymous
Not applicable

Hi @Greg_Deckler ,

 

Thanks for quick response.

 

The measure outputs is showing as 1 for all the values in the list if i use Not function. My desired out put is the customerid column should eliminate those values present in the list.

 

If in a table visual, if I place customerid columns from table and the measure , it should show me those values that are not in the list. 

 

Hope my requirement is clear. 

How about:

 

Measure 3a = 
  VAR __CustomerID = MAX('Table (3)'[CustomerID])
  VAR __Table = { "1234","2345","3452","2647","2348" }
RETURN
  IF(__CustomerID IN __Table,0,1)

 

IDK, I mocked both up in a file (attached below sig) Table (3), Page 3. Maybe because your stuff are numbers 1234, 2345, 3452 instead of text? 


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

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.

Top Solution Authors