Forum Discussion
Custom name legend
- 10 years ago
Your scenario is still confusing me. Maybe you're looking for something as below?
- Unpivot the table.
- Split the Product column by dot.
- Rename the column properly.
In report window, to avoid confusion, instead of individual pie charts, use one chart with slicer. Create a measure Product Indicator and show it in a Card visual.
Product Indicator = IF(ISFILTERED('Table'[Product]),LASTNONBLANK('Table'[Product],""),"all product")Check more details in a
ankitpatiraNo I don't want to chance any values.
I have data with columns named "Product1.FaultA", "Product1.FaultB", "Product2.FaultA", "Product2.FaultB" and so on. These variables are binary data (0 = no fault, 1 = fault)
I draw 2 pie charts. In the first I use variables Product1.FaultA and Product1.FaultB. These columns are summed giving me answer how many FaultA and FaultB are in all of the Products1. Same is done for product2.
Now I set legends on. Legends say "Product1.FaultA", "Product1.FaultB" in the first chart and "Product2.FaultA", "Product2.FaultB" because these are the variable names. For reader this is confusing because first chart only contains Product1 faults. So legends shouldn't say Product1.FaultA but only FaultA. If I rename columns I would end up with two FaultA columns (one for product1 and one for product2).
I'am not even sure if this is possible, but for estetic point of view it would be nice.
One thing you could try is creating a calcuated table with three columns-
1. "Product" - The name of the product.
2. "FaultA" - The sum of that product's FaultA column.
3. "FaultB" - The sum of that product's FaultB column.
Polulating them with the products you want to show in the pie charts, and then creating several pie-charts, each with "FaultA" and "FaultB" as their values sources, and a visual level filter applied on each one, in order to make them show only the values of a specific product.
You can achieve this by performing the following steps:
1. In the "Modeling" ribbon's "calculations" section, click on the "New Table" button.
2. Enter a DAX expression representing the table you want to create. For example, you can create a UNION of ROWs. For Example-
DisplayableProductsTable = UNION(
ROW("Product", "Product1", "FaultA", SUM(srcTable[Product1.FaultA]), "FaultB", SUM(srcTable[Product1.FaultB])),
ROW("Product", "Product2", "FaultA", SUM(srcTable[Product2.FaultA]), "FaultB", SUM(srcTable[Product2.FaultB])),
ROW("Product", "Product3", "FaultA", SUM(srcTable[Product3.FaultA]), "FaultB", SUM(srcTable[Product3.FaultB]))
)
3. Add a pie-chart to your page and put the FaultA and FaultB in its "values" field well.
4. Add the Products column to the pie-chart's visual level filters field well and select a product to have only its values shown.
5. Repeat steps 3 - 4(Or copy and paste the first pie-chart).