Forum Discussion
Lennard
3 years agoFrequent Visitor
selectedvalue doesnt work with date-aggregations
Hey there, I have problems to solve the following task: Ich have 2 Data Tables 1) --> TargetSalesPerDay for each Project 2) --> individual Project Start / End-Date I managed ...
- 3 years ago
Solution: I worked it out with a vitual table:
Target_table=filter(filter(filter(CROSSJOIN(Kalendar,ProjectAppointment,Project),Project[SalesProjectID]=ProjectAppointment[SalesProject]),Kalendar[Tag]>=ProjectAppointment[Start]),Kalendar[Tag]<ProjectAppointment[End])and the related measure:Final_target = sum(Target_table[TargetSalesPerDay])Now it works!Best regards
TomasAndersson
Solution Sage
3 years agoHi!
Since there's no longer a unique value when using years etc. SELECTEDVALUE() might not work. You should be able to use the following instead (you might have to adjust to match your table and column names):
_TargetSales =
CALCULATE(sum('Table'[_TargetSalesPerDay]),
filter(ALLSELECTED(ProjectAppointment),
max('Dates'[Date])>=ProjectAppointment[Start] &&
max('Dates'[Date])<ProjectAppointment[End])
)