Different color schemes for bars chart in PowerBI - powerbi

Hi I'm trying to create a Bar Chart like this (This chart is an illustration, not created from data yet):
If the data is being fetched from a single table, how can I have dual color scheme for bar is past and future. Also how can I place a moving marker that automatically updates the TODAY placard based on whenever the report is viewed and accordingly bars should follow the past and future color schemes.
Schema is roughly as follows:
Table1: Issue ID, Release name, issue priority
Table2: Release name, Release date

In Power BI as well as in Excel, the secret is in the data layout. You can't just have all your past and future data in two columns and magically expect that some of them will turn out red and orange instead of dark and light gray.
You will need to prep your data source to include stacked series for the light gray, dark gray, red and orange series. Stack all series on top of each other and make sure that where the red and orange series have values, there are only zero values for the gray series.
I suggest you use four columns for four stacked series and divide the values accordingly.
In Power BI, you can apply the same principle as in this Excel screenshot.
Let me know if you need help translating that to Power BI.
Edit: The Power BI data does not have to be static. You can build columns with Dax functions that arrange the data in the pattern required. Add four columns to your data model with the formulas
chtPastProdA = if(tblProducts[Date]<TODAY(),tblProducts[Product A],0)
chtPastProdB = if(tblProducts[Date]<today(),tblProducts[Product B],0)
chtFutureProdA = if(tblProducts[Date]>=today(),tblProducts[Product A],0)
chtFutureProdB = if(tblProducts[Date]>=today(),tblProducts[Product B],0)
Then build a stacked column chart and stack all four of these series. Format the colors.
For the "Today" marker you would need a custom label, which Power BI currently does not support. But since the demarcation between gray and red/yellow is today, it's quite obvious where the current date is, anyway.

Related

Is it possible to recreate this visual in Power BI?

I currently have a report that kind of looks like this in Excel. Is it possible to create the same structure with the color formatting in Power BI? Especially with the Percentage Sale and Sales Amount below each other in the row?
I tried using Matrix visual but I kind of run into a problem since the columns would have different format types - whole number and percentage. Also tried with showing columns in rows, while using Percentage Sale and Sales Amount as two columns. But then I would have problems with the color formatting. Any ideas how to achieve it in Power BI?
Its actually simple ..... just follow these steps
1.) You can use matrix or table both... but I preferred tables
2.) Go to format Visual (In visualistation you can see 3 option... its the middle one)
3.) After that click on values.
4.) Now you can se background color , alterante background color etc
5.) Just choose it acc to preferences
If you want a bar label in a selected column then,
6.)In build format, right click on your column (which you want to customize)
7.)Select conditional formatting
8.)Now you can change color
9.)apply this. After that you can see your data of selected columns are showing grid bars

Having trouble building chart from multiple columns in Power BI

I would like to create a simple chart from 2 or more columns in Power BI.
Here's my data, for each column, a 1 marks an occurrence of an event, null means it did not happen.
I would like to turn this data into a very simple bar graph, showing both these fields' numeric totals (i.e. summing all the 1's). The bars would be shown side by side. I would like it to look exactly like this, only instead of male/female it would show "alcohol occurrences" and "MDMA" occurrences.
Here's my stacked column chart:
And when I try and put the column names on the axes so that they can be properly labeled, I get this:
I can achieve most of what I want using a clustered bar chart, but the problem there is that it won't let me label the axis with the alcohol / MDMA column names:
How can I make a simple, labeled graph, stacking both columns up against each other, showing the numeric sums for each column? Again, I want it to look exactly as the male/female example shown above. Is this even possible? Thank you in advance.
In the above scenario, all the values are considered to be in the same category and that means there is no direct way to do this. There are a couple of workarounds to make it look like the desired output:
To get the gap between the two bars:
You should create a new measure, Measure New = 0
Add this measure in the middle of the two values in the bar chart
This should give you a gap in between the two bars
To get the axis values added:
Create two text boxes with the text "Alcohol" and "MDMA" added
Place these text boxes below the respective bars to make it look like they are the axis values
These workarounds can become quite tedious when you have to do it for a larger number of charts/values. On a lighter note, it baffles me that you can consistently come up with these specific scenarios where you expect the charts to do exactly the opposite of what they are meant for 😉

Color Code shape map using value ranges power bi

I am unable to color US States in power bi shape map based on color ranges.
An aggregated metric is calculated based on all screen filters then it is mapped to color ranges to assign color, as adding a measure in legend field of the chart is not possible I am unable to color it.
Is Power BI dev team planning to include the feature to allow adding measure as the legend or there is any other possible way to achieve this? Any help would be appreciated.

Is it possible to develop the line charts with multiple colors in powerbi?

I developed the few Line charts for BMP280 sensor data in powerbi. This is one of the line chart for displaying the temperature value by time and device id.
But I want same line chart with different Color like this below image, whenever temperature value suddenly changes.
Can you please tell me is it possible to develop the Line chart with multiple colors?
If you're willing to consider a vertical bar chart instead of a line chart, you would be able to create a calculation for each row that determines whether the change is significant, potentially by comparing an aggregate of recent measurements to specific thresholds.
Once you do that, you would use this column's value as a legend for your visualization. So if a row has a value of "Significant Positive Change" (or something like that), the bar or bars showing that change can be red.
Your other alternative is to use an R-based visual, of which there are surely examples of this type of visualization. I'll update this answer if I find one that looks promising.
Instead of tending 1 data series, you can split it into 2 data series e.g. one with normal temperatures and one with high temperatures. Then you can just plot these in different colours. Just make sure that the ranges are same i.e. cannot be 'Auto'.

PowerBi line chart adding lines based on measures

With Power BI line charts there is a limitation of not being able to add more than one "Values" field when a "Legend" field has been defined.
The feature I need is to simply be able to plot a horizontal line based on a measure I calculate via DAX.
Currently the Analytics tab allows to add constant lines based on max/min/avg of Value but doesn't allow to specify a measure from the data model to plot as horizontal line.
Can someone provide a solution or work around to be able to plot additional horizontal lines on line chart?
The reason you can't put a second measure on your chart when you have a legend defined is because the legend creates multiple colored lines out of a single measure. If there were 2 measures, it would expect to convert both measures into multiple colored lines too, and then you'd have 2 lines that correspond to each legend item. Either the chart would have two lines with the same color, or you'd need 2 colors for the same legend item. Neither of which are very clear.
I don't think that's what you're looking to accomplish with a second measure, though. You're looking to add a reference line on the chart based on the second measure, not split the 2nd measure out by the legend. It's a reasonable request.
If your legend isn't highly dynamic and doesn't have too many items, you can create a measure for each legend item.
Say you have a Sales measure and a Sales Category with 5 items (Cat1-Cat5 for simplicity). Create 5 measures, each filtered to one legend item.
Cat1 Sales:=CALCULATE([Sales],'Your Table Name'[Sales Category]="Cat1")
Cat2 Sales:=CALCULATE([Sales],'Your Table Name'[Sales Category]="Cat2")
....
You can then remove Sales Category from your legend, and remove Sales from your Values. Instead, in Values, place the 5 measures: Cat1 Sales - Cat5 Sales. This will make one line per legend item, so your chart shouldn't look too different. However, now you've done that, you can also drag on a 6th measure as your reference line. It's not the greatest solution but it should work as a stop-gap.
In the format section of your line chart, you can also change the data color for each measure e.g. if you want your reference line black and your measures shades of blue.
There are several ideas in the Power BI ideas forum requesting a reference line based on a measure, and I do recommend adding your voice to them too. E.g. https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/15497754-ability-to-dynamically-with-dax-functions-or-meas or https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/13296177-dynamic-reference-lines