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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Reason for different results when using FILTER() mixed with report level filter

I have written a DAX code which gets the correct figure (double checked in SQL):

 

Total Active = 
    CALCULATE (
        DISTINCTCOUNT ( dim_partner[partner_id] ),
        FILTER (
            fact_transaction_monthly,
            fact_transaction_monthly[transaction_monthly_start_date] <= [LastDayofLastSelectedMonth]
                && (
                    fact_transaction_monthly[transaction_monthly_end_date] > [LastDayofLastSelectedMonth]
                        || fact_transaction_monthly[transaction_monthly_end_date] = BLANK ()
                )
                && VALUE ( fact_transaction_monthly[transaction_monthly_gmrr] ) > 0
                && VALUE ( fact_transaction_monthly[transaction_monthly_is_voided] ) = 0
                && VALUE ( fact_transaction_monthly[transaction_monthly_is_cancelled] ) = 0
                && (
                    VALUE ( fact_transaction_monthly[transaction_monthly_is_trial] ) = 0
                        || fact_transaction_monthly[transaction_monthly_is_trial] = BLANK ()
                )
        ),
        FILTER (
            dim_partner,
            VALUE ( dim_partner[is_deleted] ) = 0
                && VALUE ( dim_partner[partner_is_test] ) = 0
                && VALUE ( dim_partner[partner_is_deleted] ) = 0
                && dim_partner[partner_converted_account_type] <> "Agent"
        )
    )

 

I get a total of 2,107.

 

However, when I change my DAX code to this by removing all the filters and leaving just the first one. I add the other filters as a page level filter e.g. is_voided, is_cancelled = 0, I get a total of 2,184

 

Total Active Partners = 

    CALCULATE (
        DISTINCTCOUNT ( dim_partner[partner_id] ),
        FILTER (
            fact_transaction_monthly,
            fact_transaction_monthly[transaction_monthly_start_date] <= [LastDayofLastSelectedMonth]
                && (
                    fact_transaction_monthly[transaction_monthly_end_date] > [LastDayofLastSelectedMonth]
                        || fact_transaction_monthly[transaction_monthly_end_date] = BLANK ()
                )
                
    )
)

 

 Is there a reason why I get a wrong result when mixing the filter function with the page level filter

2 REPLIES 2
Anonymous
Not applicable

mdbuzzer15_0-1671009991129.png

It still shows different results, the one on the right is when I add all filters within the DAX code and the one on the left is when I just have one filter and the rest has been added as page level filters 

 

v-zhangti
Community Support
Community Support

Hi, @Anonymous 

 

You can try the following methods.

Total Active Partners =
CALCULATE (
    DISTINCTCOUNT ( dim_partner[partner_id] ),
    FILTER (
        fact_transaction_monthly,
        [transaction_monthly_start_date] <= [LastDayofLastSelectedMonth]
            && OR (
                [transaction_monthly_end_date] > [LastDayofLastSelectedMonth],
                [transaction_monthly_end_date] = BLANK ()
            )
    )
)

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.