Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I m trying to create a measure to count number of invoices below threshold, threshold table is defined as below.
my measure is working somehow but not giving total number of invoices, there is something wrong.
kindly need assistance.
Invoice Count Below threshold = VAR CurrentInvoiceAmount = [Inv. Amt SAR]
VAR ThresholdValue =
CALCULATE(
MAX(Matrix_Invoice_Value[Value]),
TREATAS(
VALUES(Route_Master[Country]),
Matrix_Invoice_Value[Country]
),
TREATAS(
VALUES(Customer_Master[Trade Category]),
Matrix_Invoice_Value[Customer Type]
),
TREATAS(
VALUES(Route_Master[Route Type3]),
Matrix_Invoice_Value[Route Type3]
),
TREATAS(
VALUES(Route_Cat[Attribute]),
Matrix_Invoice_Value[Attribute]
)
)
RETURN
CALCULATE(
[Invoice Count],
FILTER(
Daily_invioces,
AND(
NOT (ISBLANK(ThresholdValue)),
CurrentInvoiceAmount < ThresholdValue
)
)
)
threshold table
Threshold Table Min invoice target value
Measure result:
Result of my measure
Data model
Data Model
Solved! Go to Solution.
I was able to get desired result from below DAX:
Invoice Count Below threshold =
SUMX(
Daily_invioces,
VAR CurrentInvoiceAmount = [Inv. Amt SAR]
VAR ThresholdValue =
CALCULATE(
MAX(Matrix_Invoice_Value[Value]),
TREATAS(
VALUES(Route_Master[Country]),
Matrix_Invoice_Value[Country]
),
TREATAS(
VALUES(Customer_Master[Trade Category]),
Matrix_Invoice_Value[Customer Type]
),
TREATAS(
VALUES(Route_Master[Route Type3]),
Matrix_Invoice_Value[Route Type3]
),
TREATAS(
VALUES(Route_Cat[Attribute]),
Matrix_Invoice_Value[Attribute]
)
)
RETURN IF(AND(
NOT (ISBLANK(ThresholdValue)),
CurrentInvoiceAmount < ThresholdValue
),1
)
)
I was able to get desired result from below DAX:
Invoice Count Below threshold =
SUMX(
Daily_invioces,
VAR CurrentInvoiceAmount = [Inv. Amt SAR]
VAR ThresholdValue =
CALCULATE(
MAX(Matrix_Invoice_Value[Value]),
TREATAS(
VALUES(Route_Master[Country]),
Matrix_Invoice_Value[Country]
),
TREATAS(
VALUES(Customer_Master[Trade Category]),
Matrix_Invoice_Value[Customer Type]
),
TREATAS(
VALUES(Route_Master[Route Type3]),
Matrix_Invoice_Value[Route Type3]
),
TREATAS(
VALUES(Route_Cat[Attribute]),
Matrix_Invoice_Value[Attribute]
)
)
RETURN IF(AND(
NOT (ISBLANK(ThresholdValue)),
CurrentInvoiceAmount < ThresholdValue
),1
)
)
it didn't solve my problem, I think we need to use iterator function, which will scan all "daily invoice" table and count invoices which are below criteria mentioned in threshold table. Please help.
@adsam First, please vote for this idea: https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e
This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
Also: https://youtu.be/uXRriTN0cfY
And: https://youtu.be/n4TYhF2ARe8
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |
| User | Count |
|---|---|
| 25 | |
| 16 | |
| 8 | |
| 7 | |
| 7 |