Forum Discussion
how to use filter with summarize function
Hi,
I want to create dax expressionon below sql:
select sum(business_duration), 'Task SLA'[task], 'Task SLA'[has_breached], 'Task SLA'[sla]
from task_sla
where
task_sla.task = child.number
group by
'Task SLA'[task], 'Task SLA'[has_breached], 'Task SLA'[sla]
and have made a similar kind of DAX like below:
7 Replies
- amitchandakSuper User
Anonymous , You can use
filter(Crossjoin(Table1,table2),table1[a]=table2[a])
but this is very costly
refer these are few options here
https://www.sqlbi.com/articles/from-sql-to-dax-joining-tables/
also like
summarize(filter(Table1,Table1[a] = max(Table2[a])),Table1[id],Table1[a],"Measure1",[measure]....)
- AnonymousNot applicable
Hi,
I have used the below DAX:
Child Task SLA2 =SUMMARIZE(filter('Task SLA', 'Parent'[number] = Max('Task SLA'[task])),'Task SLA'[task],'Task SLA'[has_breached],'Task SLA'[sla],'Task SLA'[Child Task],'Task SLA'[Duration Bucket],"Business Duration", SUM('Task SLA'[Business Duration Days]))but I am facing the below error message:A table of multiple values was supplied where a single value was expected.any help on this?- v-lionel-msftCommunity Support
Hi Anonymous ,
Maybe you should create relationship first.
Then Create a calculated table.
Table = SUMMARIZE( FILTER( 'Task Sla', 'Task Sla'[task] = RELATED(Child[number]) ), 'Task SLA'[task], 'Task SLA'[has_breached], 'Task SLA'[sla], "Business Duration", SUM('Task Sla'[Business]) )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.