Forum Discussion
nps59718
8 years agoFrequent Visitor
A function 'CALCULATE' has been used in a True/False expression - Simple Date comparison
Hi There, I'm looking for a more elegant way sum based on a prior business day calculation. The following *does work* but will get a little more cumbersome when doing MTD or YTD calculations: ...
- 8 years ago
Try this one
Prior Day Invoiced = VAR PreviousBusinessDay = [Priorbusinessday] RETURN CALCULATE ( SUM ( 'Sales Ledger Transactions'[Net Sales] ), 'Sales Ledger Transactions'[Fact Attributes.Source Sale Type Code] = "INVOICED", 'Sales Ledger Transactions'[Date.Date] = PreviousBusinessDay )
Zubair_Muhammad
Community Champion
8 years ago
Try this one
Prior Day Invoiced =
VAR PreviousBusinessDay = [Priorbusinessday]
RETURN
CALCULATE (
SUM ( 'Sales Ledger Transactions'[Net Sales] ),
'Sales Ledger Transactions'[Fact Attributes.Source Sale Type Code] = "INVOICED",
'Sales Ledger Transactions'[Date.Date] = PreviousBusinessDay
)- Anonymous7 years agoNot applicable
Zubair_Muhammad Nice solution setting the measure equal to a variable first. Works around Calculate not accepting a true/false expression as a filter very nicely :smileyhappy: Thank you!
- Anonymous7 years agoNot applicable
Worked for hours on this problem before I found this solution. Thank you Zubair_Muhammad !
Any help explaining why it wouldn't work without creating the variable? I still don't understand the error fully.
rq
- Doodle6 years ago
Advocate II
Same here.
Any elaboration is appreciated.
- nps597188 years agoFrequent Visitor
Thanks for your help Zubair - it worked well!