The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
Consider the following simple example of two possible line graphs based on counts:
What I want, however, is a graph with percentages (like the second one), but where the percentages are not in terms the overall total, but in terms of the totals for the x-axis values (i.e. subtotals by date). In other words, for 01 May 2019, I want to have values 50% (3 / 6) for Group A and 50% (3 / 6) for Group B; for 02 May 2019, I want to have values 75% (6 / 😎 for Group A and 25% (2 / 😎 for Group B; for 03 May 2019, I want 33% (2/6) and 66% (4/6) respectively.
How do I go about to do that? (I suppose I need to create a measure in DAX, but I am not sure how to construct it).
Thanks.
You can create two measures using DAX below:
Percentage Of Group A = CALCULATE(SUM('Table'[Count of Group]), FILTER(ALLEXCEPT('Table', 'Table'[Date]), 'Table'[Group] = "A")) / CALCULATE(SUM('Table'[Count of Group]), ALLEXCEPT('Table', 'Table'[Date])) Percentage Of Group B = CALCULATE(SUM('Table'[Count of Group]), FILTER(ALLEXCEPT('Table', 'Table'[Date]), 'Table'[Group] = "B")) / CALCULATE(SUM('Table'[Count of Group]), ALLEXCEPT('Table', 'Table'[Date]))
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.