This is a nice case for Tableau Prep,
because the answer would require
some data transformations, namely,
a Split-then-Pivot, which is not possible
to do directly in Tableau Desktop.
Besides, to count the original 'rows'
(or some other Dimensions values),
they should be present in the datasource,
hence the [Row ID] in the sample data.
Please find the attached flow and workbook.