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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
MichaelSamiotis
Resolver I
Resolver I

DAX formula to filter fact table from dim table

Hi all,

 

I have created the below formula which doesn't filter the dim table and I get the same value for all the values including -1.

My fact table is the Fact_score and the dim table is the Dim_overall_experience. They are connected with 1=>* on Fact_score[Rate of the overall experience] = Dim_overall_experience[Overall_experience].

 

Count of overall experience =
CALCULATE (
    COUNT ( Fact_score[Rate of the overall experience] ),
    Dim_overall_experience[Overall_experience] <> -1
)
 
I amended it to the following which works very nicely but can't get my head around as to why the first one is not working as I am filtering the dim_table which is connected to the fact table. Am I missing something foundational here?:
 
Count of overall experience =
CALCULATE (
    COUNT ( Fact_score[Rate of the overall experience] ),
    Fact_score[Rate of the overall experience] <> -1
)
 
Thank you all in advance.
1 ACCEPTED SOLUTION
MichaelSamiotis
Resolver I
Resolver I

I figured it just now. This has to do with filter context. When I filter with Dim_overall_experience[Overall_experience] <> -1 PBI replaces-overrides any filter in the current row with that, so it returns all rows from the fact table without -1 and does the same for each of the categories. When I put the FILTER function, it gives a subset of the table for each category and doesn't replace it on each one.

 

The below worked too:

CALCULATE (
    COUNT ( Fact_score[Rate of the overall experience] ),
    FILTER(Dim_overall_experience,Dim_overall_experience[Overall_experience] <> -1)
)

View solution in original post

3 REPLIES 3
MichaelSamiotis
Resolver I
Resolver I

I figured it just now. This has to do with filter context. When I filter with Dim_overall_experience[Overall_experience] <> -1 PBI replaces-overrides any filter in the current row with that, so it returns all rows from the fact table without -1 and does the same for each of the categories. When I put the FILTER function, it gives a subset of the table for each category and doesn't replace it on each one.

 

The below worked too:

CALCULATE (
    COUNT ( Fact_score[Rate of the overall experience] ),
    FILTER(Dim_overall_experience,Dim_overall_experience[Overall_experience] <> -1)
)
Idrissshatila
Super User
Super User

Hello @MichaelSamiotis ,

 

Can you make sure that these two tables have an active relationship in the data model view.

 

Idrissshatila_0-1677062625836.png

 

If I answered your question, please mark my post as solution so it would appeare to others, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Hi @Idrissshatila . Thank you for your reply.

 

The relationship is active as below with both data types being whole number.

MichaelSamiotis_0-1677063230902.png

 

With the formula

Count of overall experience =
CALCULATE (
    COUNT ( Fact_score[Rate of the overall experience] ),
    Dim_overall_experience[Overall_experience] <> -1
)
 
I am getting the below@
 
MichaelSamiotis_1-1677063321829.png

The field category in the Funnel graph is the column in my dim table and the Values is the measure.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.