I have a dataset that looks like.
+------------+-------+----------+--+
| Date | Sales | Salesmen | |
+------------+-------+----------+--+
| 12/31/1999 | 100 | P1 | |
| 12/31/1999 | 100 | P2 | |
| 12/31/1999 | 300 | P3 | |
| 01/31/2000 | 500 | P2 | |
| ... | | | |
| 07/31/2020 | 500 | p3 | |
+------------+-------+----------+--+
But I want to visualise this as a line chart (with multiple lines for each salesmen), as a percentage of the total sales per salesman per year and visualise it over the full 20 year period(1999-2020)yearly.
Power BI for visualising lines has 3 fields: Axis , Legend and Values. I placed date in axis, Salesmen in legend and for values I created a measure of the Sales(displayed "As a % of Grand total" option), however it doesn't return what I would like it to.
Measure = CALCULATE(SUM('Table1'[Sales]),FILTER('Table1','Table1'[Date].[Year]=2020))
However this only returns percentage values of the sum total for 1 year.
and the visualisation outputs a table that looks like.
So I used another measure
Measure = SUMX(CALCULATETABLE('Table1','Table1'[Date].[Year]), 'Table1'[Sales])
however this reverts the same value for each year.
However this produces a table that looks like:
I need it as a sum total of sales per year split as percentage among the 3 salesmen, then visualised. So I know there's something I'm missing in the measure, any suggestions?