Join 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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi all,
I am using a CALCULATE formula to try to return a count of the number of documents which have been paid in 30 days or less. I can quite easily and correctly return the number of paid documents using
PaidDocuments =
CALCULATE(
COUNTA(IMSDocuments[Unique Document Id]) + 0,
USERELATIONSHIP(Dates[Date], IMSDocuments[Payment Performance Adjusted Payment Date])
)
PaymentsMadeWithin30DaysCount =
CALCULATE(
COUNTA(IMSDocuments[Unique Document Id]) + 0,
FILTER(IMSDocuments, IMSDocuments[Payment Performance Adjusted Payment Date] - IMSDocuments[Creation Date] <= 30), -- this is the problem line
USERELATIONSHIP(Dates[Date], IMSDocuments[Payment Performance Adjusted Payment Date])
)I think the problem could be in my relationships so have attached a stripped back copy of my report here PaymentPerformance.pbix. Can somebody correct where I have gone wrong?
Solved! Go to Solution.
I have solved my own problem using a CROSSFILTER.
PaymentsMadeWithin30DaysCount =
CALCULATE(
CALCULATE(
COUNTA(IMSDocuments[Unique Document Id]) + 0,
FILTER(IMSDocuments, IMSDocuments[Payment Performance Adjusted Payment Date] <= IMSDocuments[Creation Date] + 30),
USERELATIONSHIP(Dates[Date], IMSDocuments[Payment Performance Adjusted Payment Date])
),
CROSSFILTER(Dates[Date], IMSDocuments[Creation Date], NONE)
)It turns out that the DAX was filtering based on an exisiting (important) active relationship. Crossfilter ignores that relationship and only uses the one I want it to use.
I have solved my own problem using a CROSSFILTER.
PaymentsMadeWithin30DaysCount =
CALCULATE(
CALCULATE(
COUNTA(IMSDocuments[Unique Document Id]) + 0,
FILTER(IMSDocuments, IMSDocuments[Payment Performance Adjusted Payment Date] <= IMSDocuments[Creation Date] + 30),
USERELATIONSHIP(Dates[Date], IMSDocuments[Payment Performance Adjusted Payment Date])
),
CROSSFILTER(Dates[Date], IMSDocuments[Creation Date], NONE)
)It turns out that the DAX was filtering based on an exisiting (important) active relationship. Crossfilter ignores that relationship and only uses the one I want it to use.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 38 | |
| 38 | |
| 28 | |
| 27 |
| User | Count |
|---|---|
| 124 | |
| 88 | |
| 73 | |
| 66 | |
| 65 |