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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply

Only get filtered results from connected table

Good morning,

I've been struggling with this for a few days.  I have 2 tables (Budgets & Data), a guage, and a slicer.  I'm trying to get the guage to show the correct target budget no matter Category (or mix of categories) is selected in the slicer.

 

Below is the code I have, but both NoFilter and HasFilter keep returning the same value or those Big Projects with mutiple subprojects get over represented.  I've tried various GROUPBY, SUMMARIZE, etc, and I just cannot get this to work.  What am I doing wrong?  Shouldn't VALUES only return the Categories currently in the filter?

 

 

 

_Target Budget = 
VAR FilterCheck = ISFILTERED('Data'[Category])
VAR NoFilter = SUMX('Budgets', [Budget])
VAR HasFilter = 
    ADDCOLUMNS(
        VALUES('Budgets'[Category]),
        "@Budget", SUMX('Budgets', [Budget])
    )
VAR Result = 
    IF(
        FilterCheck,
        SUMX(HasFilter, [@Budget]),
        NoFilter
    )
RETURN Result

 

 

 

Budgets:

PK_IDCategoryBudget
BP1Big Project 11,000,000
BP2Big Project 22,000,000
BP3Big Project 35,000,000
BP4Big Project 42,000,000

 

Data:

PK_IDFK_IDNameCost
SP1BP1Subproject 1500,000
SP2BP2Subproject 2.11,500,000
SP3BP2Subproject 2.2200,000
SP4BP3Subproject 34,300,000
SP5BP4Subproject 42,500,000

 

Edit 2/1/2024: Edited the pasted formula.  I did a lot of simplifying my code for understanding and screwed up which table a column was tied to.

1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @ronnie_roberts 

 

I'm not sure what your measure would have over something like this.

My Budget = SUM( 'Budgets'[Budget] )

 

Take a look at my comparison.

Only get filtered results-from connected table.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

4 REPLIES 4

Thank you for the feedback!  I did a ton of simplifying creating this example and when I set things up as you suggested, yeah SUMX works just fine.  Obviously one of the other things going on in my report is causing the issue.  I'll keep searching.

gmsamborn
Super User
Super User

@ronnie_roberts 

 

Does this help?  I added CALCULATE around your SUMX when defining _HasFilter.

 

_Target Budget 2 = 
VAR _FilterCheck = ISFILTERED('Budgets'[Category])
VAR _NoFilter = SUMX('Budgets', [Budget])
VAR _HasFilter = 
    ADDCOLUMNS(
        VALUES( 'Budgets'[Category] ),
        "@Budget", CALCULATE( SUMX('Budgets', [Budget])  )
    )
VAR _Result = 
    IF(
        _FilterCheck,
        SUMX( 
            _HasFilter, 
            [@Budget]
        ),
        _NoFilter
    )
RETURN 
    _Result

 

 

Can you explain why you wrote your measure that way?  As far as I can tell, [My Budget] mentioned above seems to work.

 

Only get filtered results-from connected table - test.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
gmsamborn
Super User
Super User

Hi @ronnie_roberts 

 

I'm not sure what your measure would have over something like this.

My Budget = SUM( 'Budgets'[Budget] )

 

Take a look at my comparison.

Only get filtered results-from connected table.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
gmsamborn
Super User
Super User

Hi @ronnie_roberts 

 

In your measure you refer to 'Data'[Category] but in your tables you say that [Category] is a column of Budget, not Data.

 

Let me know if this helps.



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.