Probably my question is not self-explanatory, and for that reason I'm using a dummy table to explain what my problem is and what I would like to get. I have a table like following
|channel|year|revenue|
online 2011 10
reseller 2011 40
online 2012 15
reseller 2012 45
online 2013 28
reseller 2013 28
I visualized this data in a clustered bar chart (axis= year, legend=channel, and value= revenue) and it shows me numbers of yearly revenue contributed by different channel, for example in 2011, online 10 and reseller 40.
But I would like to show it as percentages of total sales for 2011 (for example, 2011 online 20% & reseller 80%, for 2012 online 25% & reseller 75%, for 2012 online 50% & reseller 50%.
How it can be achieved? probably I need to get a new measure but don't know the DAX. Any suggestion is appreciated.
You can use simply calculation:
YourRevenueMeasure =
SUM('YourTable'[Revenue])
PercentageOfSales =
DIVIDE( [YourRevenueMeasure],
calculate( [YourRevenueMeasure], FILTER(ALL('YourTable'), 'YourTable'[Year] = SELECTEDVALUE('YourTable'[Year])))
)
First create this below Measure-
revenue_ =
var total_ =
CALCULATE(
SUM(your_table_name[revenue]),
ALLEXCEPT(
your_table_name,
your_table_name[year]
)
)
RETURN MIN(your_table_name[revenue])/total_
Now change the measure type as % and use it in the Values field in Clustered Bar Chart.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.