SQL count on multiple fields in BAQ

Company Plant Order Line
88888 ABC 5522 1
88888 ABC 5522 2
88888 ABC 5524 1
88888 ABC 5591 1
88888 ABC 5591 1

How do you do count(distinct order, line)
In above example, grouping on company and plant, result is 4

I think SQL would be something like
select count(*) from (select distinct company, plant, order, line from orderdtl) as orderlines
But I’m confused how to do it in BAQ


(select distinct company, plant, order, line from orderdtl)

as a subquery, then your top level query performs the count/group by

Thank you Aaron,
The sub query is select company, plant, ordernum, orderline from orderdtl with Result Set Rows = DISTINCT

Top level query is just orderhed.company and plant
I add subquery in as table, link it left join
Take company and plant from orderhed and set them as group by
then what is the calc field?
It’s not count(*)… that returns 17,000+ records when actual rows is 177.

Shoot, disregard, I didn’t define the subquery parameter, and was returning all dates