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
TheOnlyBob_2
Frequent Visitor

Ignore a specific filter in a measure

Hi, I've been pulling my hair out over this for 2 days now and I can't seem to get the result I want.

 

Essentially I've been trying to create a measure that will count all visits, regarless of the filter I have applied on 'Class 2'

I've tried dozens of different methods, but I think I'm misunderstanding something fundamental about how filters are applied accross relationships.

 

I'm starting with a variation on:

 

Total Visits = CALCULATE(COUNTROWS(Visits),ALL(accounts[class 2]))

 

however the filter is still applied.

An example of my data model is belowCapture.PNG

 

 

 

3 REPLIES 3
Anonymous
Not applicable

One thing you can do is create an alias (Go to Query Editor-> Right click on table ->Create Reference for Visits table    )

 

 

 Capture.PNG

 

A copy of your visits table will be created.

Now, you have 2 same tables for Visits. Make sure the duplicate one is not connected to any other table (Manage relationships)

 

Create your measure using this new table instead oforiginal one and keep everything else as is.

This measure should not be impacted by any filtering as the table is not joined with any other table in our model.

The logic looks correct to me. How do you know it is not working?  I suggest create a matrix and put class 2 on rows. Then put the measure you wrote in the values for the matrix.  From what I can see, it should return the same result all the way down the matrix = working as design. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Hi Matt,

 

Sorry about the slow response - I have been working on another project.

 

I tried your suggestion of putting it on a matrix, and I do not get the expected result

 

The first measure Total Visits is the same as in my initial posts

The Second Number of Visits is simply              Number of Visists = countrows(visits)

 

 

They both return the same values - I can't seem to attach an image.

I'd rather achieve this with a measure rather than a second unrelated table as there are still things I do need to filter.

 

 

 

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.