Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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
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
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.