How do I convert InfluxQL "show series cardinality" into Flux?

I want to convert the below query to Flux - can it be done?

show series exact cardinality from "Measurement" where "TagName" != '' group by "TagName"