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
Alejo_Azurica
New Member

Difference in filter context from a dimension and from a column in the fact table

Working with a measure i encountered a mishap in how to treat blank values as zeroes, I was able to work around the issue but how some intermediate solutions interacted with filters baffled me, so I was hoping some of you could help clear things up.

 

I intended to treat blank values as zeros when it's evaluated in a table listing all of the Fact_table rows.

 

The setup is you have a fact table and a dimension table:

 

Fact_table:

Alejo_Azurica_2-1689953839044.png

Fact_ID,Value,Dim_Id
1,34,2
2,15,1
3,,2
4,,2
5,10,2

 

Dim_table:

Alejo_Azurica_3-1689953881795.png

Dim_ID,Category
1,"cat1"
2,"cat2"

 

two simple measures:

Sum Value := SUM(Fact_table[Value])

Sum Value No Blanks := SUM(Fact_table[Value]) + 0

the sample model:

Alejo_Azurica_0-1689953369486.png

 

When you use [Sum Value] in a table listing all Fact_Id, the Ids that make the measure evaluate to blank are omitted(which is expected):

Alejo_Azurica_1-1689953673621.png

When you use [Sum Value No Blanks] in the same table, all the Ids are listed now(which is expected):

Alejo_Azurica_4-1689954008861.png

Now when you filter by the dimension table by the cat2 this is how they behave:

Alejo_Azurica_5-1689956894840.png

Fact_Id 2 still is included in the table visual despite it being a row of category cat1(which shouldn't be included), I understand the stance that it is been shown because the measure is evaluating to a non-blank value however when you filter by the Dim_id column in the Fact_table the result is the following:

Alejo_Azurica_6-1689957316597.png

Now row 2 of Fact_table is no longer being included despite the measure not being evaluated to blank anymore.

I understand that the two contexts should be equivalent yet they aren't.

my first intuition was that it was something to do with the table visual and that it treats filters affecting table columns included in the table directly differently from those coming from filters in other tables and being passed along the relationship but when you include the Category column from the Dim_table it seems to behave in the same manner.

 

do you have any explanations for the difference in behavior in what seem to be equivalent filter contexts?

2 REPLIES 2
foodd
Super User
Super User

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).


https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...


Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

 

This allows members of the Forum to assess the state of the model, report layer, relationships, and any DAX applied.

sample report: https://we.tl/t-kvoC6ACUMj

 

the expected result is for the filter on the dimension table and the filter on the column from the fact table to produce the same result 

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.