问题
I have a table that looks like this
| Date | Total | Loss |
|---------------------|---------|--------|
| Jan 1 2018 | 90 | 5 |
|---------------------|---------|--------|
| Jan 3 2018 | 10 | 5 |
|---------------------|---------|--------|
| Feb 1 2018 | 50 | 5 |
|---------------------|---------|--------|
| Feb 3 2018 | 50 | 10 |
|---------------------|---------|--------|
I wanna be able to show in a table how much percentage of "Total" "Loss" is depending on the period.
For example if in my dashboard I show the table visualizer as months, it should give :
| Date | Loss % |
|---------------------|---------|
| Jan 2018 | 10% |
|---------------------|---------|
| Feb 2018 | 15% |
|---------------------|---------|
But if I show it as year, it should give :
| Date | Loss % |
|---------------------|---------|
| 2018 | 12.5% |
|---------------------|---------|
Right now the only solution I have found is to create tables in the Data tab that would sum up my main table for each Month. But that can't be a permanent solution to me (I end up with too many tables, as I have to do that kind of table for many different columns and conflicting relationships).
回答1:
I achieved the same result by adding the following measure to your table LossPercent = 100 * SUM(SalesData[Loss]) / SUM(SalesData[Total])
, then adding a relationship between the date and a Dates table, which contains a breakdown of dates into the groupings you want to display.
回答2:
You can create a Loss %
measure:
Loss % =
DIVIDE (
SUM ( TableName[Loss] ),
SUM ( TableName[Total] ),
BLANK()
)
Format the measure as percentage
来源:https://stackoverflow.com/questions/53443620/show-as-percentage-of-another-column-in-power-bi