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
Hello,
I have the following tables:
'Calendar'[Date] 1 to M -> 'Sales'[Posted Date]
My calendar table has a calculated column [Is Current Week] that holds a value of 1 if true if the date falls within the current week period I've defined.
I've been trying to write a DAX expression that will return the total sales using USERELATIONSHIP based on a inactive relationship between Calendar[Date] and Sales[Order Date]. I can get a total with this expression for a cummulative value:
CALCULATE( SUM('Sales'[Amount]), USERELATIONSHIP ( 'Calendar'[Date], 'Sales'[Order Date] ))
However, when I try to filter for only sales for the current week, my expression returns nothing. I've tried a few permutations but always end up with a blank result. Here is my latest attempt:
CALCULATE(CALCULATE( SUM('Sales'[Amount]), USERELATIONSHIP ( 'Calendar'[Date], 'Sale'[Order Date] )), FILTER(All
('Calendar'),'Calendar'[Is Current Week] = 1))
Anyone have any pointers on how or if I can accomplish this? I have reviewed this link:
https://www.sqlbi.com/articles/userelationship-in-calculated-columns/
But can't quite seem to get things working with the filter.
Solved! Go to Solution.
How about this version. It should work:
Measure =
CALCULATE (
SUM ( 'Sales'[Amount] ),
USERELATIONSHIP ( 'Calendar'[Date], 'Sale'[Order Date] ),
'Calendar'[Is Current Week] = 1
)
How about this version. It should work:
Measure =
CALCULATE (
SUM ( 'Sales'[Amount] ),
USERELATIONSHIP ( 'Calendar'[Date], 'Sale'[Order Date] ),
'Calendar'[Is Current Week] = 1
)
It actually all boiled down to a misconception that I had transactions in the current week when I did not. Thank you for your reply, I marked your answer as the solution as it does work. I
Good to hear as that was my next suggestion. I coulnd't see an issue with the measure based on facts given.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 93 | |
| 69 | |
| 50 | |
| 40 | |
| 39 |