Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

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:

Business1 =
SUMMARIZE(
'Task SLA',
'Task SLA'[task],
'Task SLA'[has_breached],
'Task SLA'[sla],
"Business Duration", SUM('Task SLA'[Business Duration Days])
)

and there is no relationship between them.
So my intention is filter the task column in the above table where
task_sla.task = child.number
 
and task_sla table has many records based on 'Task' filed, so I have used group by claue to get the
business duration value. So any suggestion to use filter condition?
 
below is the link of the data file:
 
 
 
 

7 Replies

    • Anonymous's avatar
      Anonymous
      Not 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-msft's avatar
        v-lionel-msft
        Community 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 Chen

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.