How to make a calculated field to distinctly count two columns

Hi All,

I have three columns:
customer_id
event_id
state

I need to count the status for each customer and event (the customer and distinct event)

How to make a calculated field to distinctly count two columns (customer and event)

distinctcount(customer_id, event_id) ??

Best Regards,
Tks

Hi @July,

Do you want to have the calculated field reflect a distinct count of combination of both fields (ie Customer 1 + Event 1, Customer 2 + Event 1, Customer 3 + Event 2 returns value of 3) or did you want to know the distinct count for the customer per event (ie Customer 1 + Event 1,Customer 2 + Event 1, Customer 3 + Event 2 returns grouped value of 2 for Event 1 and 1 for Event 2)?

If it is the former, you will need to combine the two fields (customer, event) into a calculated field before using in the distinctcount function. distinctcount only allows a single field as entry. An example would be creating a calculated field using Concat(customer_id, event_id) and then running a distinct count function against that calculated field.

If it is the latter, you can use LAC-A functions in the calculated value to get the expected results. Example would be distinctcount({customer_id}, [event_id]).

Do the provided options address your ask? I am marking this reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community!

1 Like