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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
asjones
Helper V
Helper V

Filter table based on Calculated Measure(s), using DAX formulas

I have the following DAX measure that I heavily simplified down to the issue.

Expense =

    VAR _Amount =

    CALCULATE(

        SUM ( Financial[Amount4] ) ,

              ProjectMasterFile[Project_Type] >= 50 

          )

    Return _Amount

 

If I create a table with columns:

ProjectMasterFile[Project], ProjectMasterFile[Project_Type], Expense

Then the Expense Measure comes out correct.

 

If I change the table to

ProjectMasterFile[Project_Type], Expense

Then the expense measure repeats the same value for all rows.

 

The original DAX has several other filters and they all worked and did not have repeated values if I did not have this line

ProjectMasterFile[Project_Type] >= 50 

 

 

The relations in the data model look correct. So what might I be doing wrong?

 

Any and all ideas are appreciated.

 

Thanks

 

Alan

 

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

@asjones 

Filter arguments within CALCULATE normally overwrite existing filters.

 

A consequence of this is that if one of the filter arguments overwrite filters on columns that are included within your visual, you will see the same value returned for each value of that column within the visual.

 

You can modify the behaviour of filter arguments so that they instead intersect with existing filters using KEEPFILTERS - possibly this will give you the value you expect.

 

Try rewriting your measure as:

Expense =
    VAR _Amount =
    CALCULATE(
        SUM ( Financial[Amount4] ) ,
              KEEPFILTERS ( ProjectMasterFile[Project_Type] >= 50 )
          )
    Return _Amount

Does this give the expected result? Please post backif needed.

 

Regards,

Owen

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
OwenAuger
Super User
Super User

@asjones 

Filter arguments within CALCULATE normally overwrite existing filters.

 

A consequence of this is that if one of the filter arguments overwrite filters on columns that are included within your visual, you will see the same value returned for each value of that column within the visual.

 

You can modify the behaviour of filter arguments so that they instead intersect with existing filters using KEEPFILTERS - possibly this will give you the value you expect.

 

Try rewriting your measure as:

Expense =
    VAR _Amount =
    CALCULATE(
        SUM ( Financial[Amount4] ) ,
              KEEPFILTERS ( ProjectMasterFile[Project_Type] >= 50 )
          )
    Return _Amount

Does this give the expected result? Please post backif needed.

 

Regards,

Owen

 


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Owen,

 

Thanks for your response. You are right .... i have used KEEPFILTERS() before, but only when I had something in the filters pane. I had never thought of Fitler Context for a visual (need to rewatch the related videos.

 

Thanks!!

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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