COUNTD in pivot

I am trying to COUNTD (count different) in a PIVOT (only COUNT is available). The thins is, that I would like to know how many different orders are in a PIVOT (each order has some lines, but I only need to count how many of those orders (without taking into account any lines into them) are…any idea?
Thanks

Can you give me a simple example with an input dataset and the dataset you want?

Further to your email, if you want to count the number of rows for each orderID in this table:

order,item,quantity
1001,A,1
1001,B,3
1002,C,1
1003,D,2
1003,E,1
1003,F,3
1004,F,2
1004,G,1

You can either do it using Unique:

Or you can add a helper column of 1s using New Col:

And then do a Pivot:

Does that help?

Thank you a lot!, it works great!

1 Like