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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
GunnerJ
Post Patron
Post Patron

Filter context issue - different values for total and on bar chart

I have a measure that counts the rows of a flagged value. When looking at a card or the count next to a table with account #s the value seems plausible. When I throw that value on a bar chart I get some wild totals which are actually several times greater than my supposed grand total. 

 

Below (left) card just showing total. (right) same measure with an x-axis from the same table.

GunnerJ_0-1655219628810.pngGunnerJ_1-1655219640457.png

 

Here is the measure being used.

Total Pendings = 
VAR __Table9 = 
    CALCULATETABLE(
        GENERATE( 
            VALUES( 'MASTER CHARGE ACTIONS'[BI_ACCT]),
            SELECTCOLUMNS(
                TOPN(1, FILTER( 'MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[Total Pending Flag] >= 1),
                    'MASTER CHARGE ACTIONS'[ROWRANK]
                ),
                "CHG_DATE", 'MASTER CHARGE ACTIONS'[CHG_DATE],
                "Account Status", 'MASTER CHARGE ACTIONS'[Account Status]
            )
        ),
        ALLEXCEPT('MASTER CHARGE ACTIONS','MASTER CHARGE ACTIONS'[BI_ACCT],'MASTER CHARGE ACTIONS'[Zone])
    )

var result = COUNTROWS( FILTER( __Table9, 'MASTER CHARGE ACTIONS'[Total Pending Flag] <> BLANK()) )

return result 

Shared file location below

https://www.dropbox.com/s/mnggk57lf6eccnv/OZARKSGO%202.0.pbix?dl=0

 

Any help in explaining why the totals are being altered with the new filter context would be appreciated. 

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @GunnerJ ,

 

Need to change the filtering context in the formula.

Total Pendings = 
VAR __Table9 = 
    CALCULATETABLE(
        GENERATE( 
            VALUES( 'MASTER CHARGE ACTIONS'[BI_ACCT]),
            SELECTCOLUMNS(
                TOPN(1, FILTER( 'MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[Total Pending Flag] >= 1),
                    'MASTER CHARGE ACTIONS'[ROWRANK]
                ),
                "CHG_DATE", 'MASTER CHARGE ACTIONS'[CHG_DATE],
                "Account Status", 'MASTER CHARGE ACTIONS'[Account Status]
            )
        ),
        ALL('MASTER CHARGE ACTIONS'[BI_ACCT],'MASTER CHARGE ACTIONS'[Zone])
    )

var result = COUNTROWS( FILTER( __Table9, 'MASTER CHARGE ACTIONS'[Total Pending Flag] <> BLANK()) )

return result 

 

vhenrykmstf_0-1655457302020.png

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-henryk-mstf
Community Support
Community Support

Hi @GunnerJ ,

 

Need to change the filtering context in the formula.

Total Pendings = 
VAR __Table9 = 
    CALCULATETABLE(
        GENERATE( 
            VALUES( 'MASTER CHARGE ACTIONS'[BI_ACCT]),
            SELECTCOLUMNS(
                TOPN(1, FILTER( 'MASTER CHARGE ACTIONS', 'MASTER CHARGE ACTIONS'[Total Pending Flag] >= 1),
                    'MASTER CHARGE ACTIONS'[ROWRANK]
                ),
                "CHG_DATE", 'MASTER CHARGE ACTIONS'[CHG_DATE],
                "Account Status", 'MASTER CHARGE ACTIONS'[Account Status]
            )
        ),
        ALL('MASTER CHARGE ACTIONS'[BI_ACCT],'MASTER CHARGE ACTIONS'[Zone])
    )

var result = COUNTROWS( FILTER( __Table9, 'MASTER CHARGE ACTIONS'[Total Pending Flag] <> BLANK()) )

return result 

 

vhenrykmstf_0-1655457302020.png

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-henryk-mstf  thank you for the solution! If you didn't mind explaining why the ALL in this case was the solution I'd appreciate the opportunity to learn. 

 

Thank you again.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.