Forum Discussion
Weekly average transactions for specific Hours
- 4 years ago
Justas4478
Please refer to the code I posted in my comment above. Here it is again :CALCULATE (
'Actuals'[Transactions],
FILTER (
ALLSELECTED ( 'Date'),
'Date'[Date]<= _closingdate && 'Date'[Date]>= _min),
FILTER (
ALLSELECTED('Date'[Day Name]),
'Date'[Day Name] = _saturday),
FILTER(
ALLSELECTED('Time'[Time Hour]),
'Time'[Time Hour]<= _hourend && 'Time'[Time Hour]>= _hourstart))
Try using multiple filter clauses instead of one.
Hi Justas4478 ,
You have tried to assign two values to variable _Saturday
It should either be
var _saturday = 'Date'[Day Name]
or
var _saturday = "Saturday"
Also, try modifying your filter syntax
Trial 8W Pre-period Transactions (Hours and week day) =
var _min = date(2022,01,31)
var _closingdate = date(2022,03,27)
var _saturday = 'Date'[Day Name]
var _hourstart = HOUR(10)
var _hourend = HOUR(13)
return
CALCULATE (
'Actuals'[Transactions],
FILTER (
ALLSELECTED ( 'Date'),
'Date'[Date]<= _closingdate && 'Date'[Date]>= _min),
FILTER (
ALLSELECTED('Date'[Day Name]),
'Date'[Day Name] = _saturday),
FILTER(
ALLSELECTED('Time'[Time Hour]),
'Time'[Time Hour]<= _hourend && 'Time'[Time Hour]>= _hourstart)
)
Kind regards,
Rohit
Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 😊
- Justas44784 years agoPost Prodigy
rohit_singh Day Names is a table I have in a cube. I tried to use table as variable. What option do you think would fit?
- rohit_singh4 years agoSolution Sage
Justas4478 Depends on what your requirement is. If you are looking for data specifically for Saturday, you can use
var _saturday = CALCULATE(VALUES('Day Name'[Day Name]), FILTER('Day Name','Day Name'[Day Name] = "Saturday" ))- Justas44784 years agoPost Prodigy
rohit_singh Yes apparently it needs to look at Saturday data. I manage to put what you linked in variable, But it still complains for other part of the measure. I dont know what is exactly wrong did I mess up comma or it is writen wrong?