The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi All,
Data Validation :
I am using 2 slicers (Amount in usd & churn in usd) with min & max values and few cards to display the counts based on the selected slicer values as below :
below the query which is executed from snowflake data source and the expected result is 490 , but i am getting 447 with all the filters applied in this query (using slicers in power bi report)
Snowflake query : Output - 490 row count
select * from datalake.dm_bss_oss.vw_opportunity_quote_source where sales_involvment='Sales Opportunities' and opportunity_stage='Closed Won' and closed_date between '2025-01-01'and'2025-06-30' and (amount_in_usd between '0' and '50000' or churn_in_usd between '-50000' and '0'); -- values 0,50000 and all are just a sample in this query but we have a separate slicers for the amount seelction in dashboard
DAX query : Output - 447 row count (should be 490)
Hey @DineshArivu,
From the images and the DAX you posted, the problem is because you’re using:
MIN('Opportunity Quote Source'[AMOUNT_IN_USD])
MAX('Opportunity Quote Source'[AMOUNT_IN_USD])
inside the same table you’re filtering. That causes context restriction — meaning Power BI only evaluates MIN/MAX on already filtered rows, so your OR logic acts like an AND in many cases.
The correct way is to:
Take slicer values from a disconnected parameter table (for Amount and Churn separately)
Store them in variables before filtering
Then apply the OR logic explicitly inside FILTER
Here’s the fixed measure that will work 100% and match your Snowflake query results:
Step 1 – Create two disconnected parameter tables (via Enter Data in Power BI):
MinAmt MaxAmt
0 50000
(You can add as many ranges as you want for slicer purposes.)
MinChurn MaxChurn
-50000 0
Step 2 – Create the measure using variables:
Count Opportunities OR =
VAR MinAmt =
MINX ( ALL ( 'Amount Param' ), 'Amount Param'[MinAmt] )
VAR MaxAmt =
MAXX ( ALL ( 'Amount Param' ), 'Amount Param'[MaxAmt] )
VAR MinChurn =
MINX ( ALL ( 'Churn Param' ), 'Churn Param'[MinChurn] )
VAR MaxChurn =
MAXX ( ALL ( 'Churn Param' ), 'Churn Param'[MaxChurn] )
RETURN
CALCULATE (
COUNT ( 'Opportunity Quote Source'[SFDC_ENSONO_OPPORTUNITY] ),
FILTER (
ALLSELECTED ( 'Opportunity Quote Source' ),
(
'Opportunity Quote Source'[AMOUNT_IN_USD] >= MinAmt
&& 'Opportunity Quote Source'[AMOUNT_IN_USD] <= MaxAmt
)
|| (
'Opportunity Quote Source'[CHURN_IN_USD] >= MinChurn
&& 'Opportunity Quote Source'[CHURN_IN_USD] <= MaxChurn
)
)
)
Step 3 – Use these parameter tables as slicers instead of the original columns directly.
Why this will now match Snowflake’s 490 count:
OR logic is preserved because each condition is evaluated independently.
Slicer values are coming from disconnected tables, so no filter context is lost.
Works identically to your SQL (amount between … OR churn between …) clause.
Fixed? ✓ Mark it • Share it • Help others!
Best Regards,
Jainesh Poojara | Power BI Developer
@jaineshp Thanks for your solution 🙂
I have a query in step 1 : MinAmt & MaxAmt is a dynamic here , user can select any range between that. so how to create parameter for all the range (even we don't know how user may select the range)
User | Count |
---|---|
24 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
29 | |
13 | |
11 | |
9 | |
9 |