Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi all,
I need to count the distinct # of suppliers with products having a lower margin than a field parameter. Assuming the user selects 5% as parameter, I would like to have 2 for suppliers count from the example below (A and C).
Supplier | Product | Margin | COUNT DISTINCT |
A | 1 | 1% | A |
A | 2 | 2% | A |
B | 3 | 10% | |
C | 4 | 4% | C |
As the field parameter is dynamic, I cannot use a calculated column which will only use the default value of the parameter but not update dynamically.
In SQL, I would use something like COUNT DISTINCT (IF margin < parameter then supplier else null)
What DAX formula can I use for similar result?
Thanks in advance for your help
BR
Solved! Go to Solution.
Hi @MrBlueSky2
Please use below code
SuppliersWithLowMarginCount =
VAR LowMarginSuppliers =
CALCULATETABLE(
DISTINCT('Table'[Supplier]),
'Table'[Margin] < [FieldParameter]
)
RETURN
COUNTROWS(LowMarginSuppliers)
Regards
Govind Sapkade ( Data Analyst , Power BI PL 300 Certified , MS Fabric Enthusiast )
Linkdin : www.linkedin.com/in/govind-sapkade-845104225
Youtube : http://www.youtube.com/@govind_dataanalyst
Hi @MrBlueSky2
Please use below code
SuppliersWithLowMarginCount =
VAR LowMarginSuppliers =
CALCULATETABLE(
DISTINCT('Table'[Supplier]),
'Table'[Margin] < [FieldParameter]
)
RETURN
COUNTROWS(LowMarginSuppliers)
Regards
Govind Sapkade ( Data Analyst , Power BI PL 300 Certified , MS Fabric Enthusiast )
Linkdin : www.linkedin.com/in/govind-sapkade-845104225
Youtube : http://www.youtube.com/@govind_dataanalyst
@MrBlueSky2 , Try using
dax
SuppliersWithLowMarginCount =
CALCULATE(
COUNTROWS(
DISTINCT('Table'[Supplier])
),
FILTER(
'Table',
'Table'[Margin] < [FieldParameter]
)
)
Proud to be a Super User! |
|
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
6 | |
4 | |
3 | |
3 |
User | Count |
---|---|
13 | |
11 | |
8 | |
8 | |
8 |