Reputation:
I need to show the total at the bottom of a data table in a grouped column chart in Power BI, that is, this total which is found here at the bottom of the table:
I want to show it as a value in a grouped column chart next to the value of 387 as follows:
It is important to make it clear that the columns from which the value is obtained 4:7 4:42 5:38
are columns made from a measure, that is, a DAX formula was used for its elaboration, for this reason I am not allowed to drag the column to the Values section in the clustered column chart, every time I try to place it in Values it automatically moves to Tooltip.
The column PromedioHoraPlanta
is the one that corresponds to the total displayed value of 4: 7 in the table.
I would like someone to give me guidance on how to place the total in the grouped column graph
UPDATE:
I explain a little more in detail what I use to calculate the PromedioHoraPlanta
column, which is the one that corresponds to the values of 7:28 5:56 5:21 8:55 9:49 3:45
is made from a measure with the following formula DAX:
= FORMAT(AVERAGE(Table1[t_TOTAL_SALIDA_seg])/3600 , "##") & ":" & FORMAT(MOD(AVERAGE(Table1[t_TOTAL_SALIDA_seg]),60), "##" )
The data type of the column t_TOTAL_SALIDA_seg
that is the one I am using to calculate the new measure in the above DAX formula is Whole Number
UPDATE 2:
Doing a little more research on this requirement apparently is not possible until you convert the duration to a numeric value.
Since the time and duration data are like dates and text, it is for this reason that I can only put them in the x-axis and not in the Values of the bar graph since they are considered categorical data whether they are in a line graph, graph column or bar graph as in my case.
Also if you observe in the first screenshot that I add at the beginning of the question, the value 4:7 is not really the total of that column, this is due to the part of the days is hidden by the format.
UPDATE 3:
This requirement stems mainly from a report that is made in SSRS where in its bar graph it shows the total that is represented in the table as follows, I make it clear that the following images are from the report but made in SSRS.
This is why I am trying to represent the same bar chart in Power BI, trying to show the Total of the table as values in the bar chart.
UPDATE 4:
After a weekend of much research I have decided to opt for the following measure:
NewMeasure = VAR _AVG = AVERAGE(Consulta1[t_TOTAL_SALIDA_seg]) VAR _LeftPart = DIVIDE(_AVG, 3600) VAR _RightPart = MOD(_AVG,60) RETURN _LeftPart * 100 + _RightPart
I tried to choose this measure but I don't get the exact result, it is close to the total of each column but it is not the exact one shown in the table.
The following image is of the total shown at the bottom of the table:
The following image is the values shown in the bar graph:
As you can see, your results are close but not exact, in addition to that I still cannot get it to separate with the character :
, I would like to know if there is something that should change as I have created to show its exact result, I think it is the most close to what I have been to get it but unfortunately it is not the exact result.
UPDATE 5:
I continue in my research on how to obtain the total in the bar graph I think I need to create an aggregate calculated table Summarize function and re-create my measures as calculated columns so that I can use it as values in the column chart.
I'm not sure the column chart will handle displaying your ratio values though - I think they'd be interpreted as text which will default to using a count aggregation when you add them to the visual. You might need to convert them as a percentage or decimal.
Any suggestions regarding this? Do you think this is how I can get it?
Upvotes: 2
Views: 1205
Reputation: 2062
Part of the challenge you have is that you need to chart one number and use a different field as the label. The Microsoft charts aren't always that flexible. Charticulator is a good tool to customize a chart the way you want it. Add Charticulator as a custom visual and edit the visual in Power BI Desktop following this walkthrough: https://blog.enterprisedna.co/create-a-bar-chart-visualization-with-charticulator/
For fields, here's what I used:
Plant name (text)
Duration (Whole number, in minutes)
Average duration (Decimal number) = AVERAGE('Table'[Duration])
Average duration time (Time value, formatted as h:nn)= TIME(ROUNDDOWN([Average duration]/60,0),MOD([Average duration],60),0)
Average duration label (Text) = FORMAT([Average duration time],"h:nn")
Then I passed just the Plant
,Average duration
, and Average duration label
fields to Charticulator.
Follow the walkthrough. Ignore the part about going to charticulator.com. Just do this in Power BI and pass in the fields to the visual and then click the edit button in the visual to launch Charticulator.
The walkthrough does horizontal bars, so I ignored the part about Stack Y, and you'll put Average duration
on the height of the glyph. I also still wanted the Plant name on the axis, so I skipped the part of toggling off the Visible box. If you anchor the Text at the top of your glyph, and then adjust the settings, it can go right above the bar. Where the walkthrough sets the text to Assignee, you'll use the Average duration label
.
The walkthrough doesn't do a Grouped Bar Chart, but Charticulator can do that too.
Upvotes: 0