Forum Discussion
Help with the graphic
- 6 years ago
Ok, Anonymous I got your file. I did a little digging and now it makes sense to me. Measures return a single value, which depends on the filter context. You cannot use that in a legend. You have two options that I see:
- Create the field values in Power Query. That will be difficult because of the way the data is stored in other tables and will require joins.
- Create a calculated column. Your SWITCH measure will actually work there, but you'll need to test. You can drop that into a legend field of a Pie Chart.
Then create a measure you want in your values part of the chart.
Test Value = COUNTROWS(META_MTTR) for example will count the number of records for each META and show the relevant percentages in the chart.
As a slight aside, if you will convert your [MTTR promedio (horas)] and [MTTR máx (horas)] to numbers in Power Query (the Tipo cambiado step) click the little ABC in the upper left corner of that column and change it to a number, then you can dispense with all of the VALUE() functions in your model.Does that help? The issue is you really need to have most/all of your fields you want to slice and dice on coming in as fields from Power Query, and use measure to be the values. There are a lot of places measures cannot work. Slicers, filters, and as we've discovered, many parts of a lot of visuals, because measures return 1 value at calc. You see many in a table, but in reality, it is one value. It just recalculates the measure for that row of the table based on the filter context. It isn't returning a column of 4/5 values you can use as a true column.
I'd have to see your PBIX file or more info. It works fine for me.
You can actually drag your METAS1 field to Values and tell Power BI to do a count, but that can cause problems later if you make any changes to how METAS1 works. Always best to do an explicit measure, even for something as simple as a row count.
Post a sample PBIX file if this isn't working for you. Use OneDrive or something similar to share.
Ok, Anonymous I got your file. I did a little digging and now it makes sense to me. Measures return a single value, which depends on the filter context. You cannot use that in a legend. You have two options that I see:
- Create the field values in Power Query. That will be difficult because of the way the data is stored in other tables and will require joins.
- Create a calculated column. Your SWITCH measure will actually work there, but you'll need to test. You can drop that into a legend field of a Pie Chart.
Then create a measure you want in your values part of the chart.
As a slight aside, if you will convert your [MTTR promedio (horas)] and [MTTR máx (horas)] to numbers in Power Query (the Tipo cambiado step) click the little ABC in the upper left corner of that column and change it to a number, then you can dispense with all of the VALUE() functions in your model.