Is it possible to develop the line charts with multiple colors in powerbi? - 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'.

Related

Percent Calculation in Quicksight

I want to calculate percent based on count of events. Basically, I want to calculate successful login attempts on a website. Something like below
count(successful_attempts)/count(total_attempts)
successful_attempts and total_attempts are recorded as events in login_attempts column.
How would I achieve this?
There are mainly 2 approaches to your problem.
Compute the percentage yourself:
You can add a calculated field to your analysis or your dataset and use the a similar formula to the one you mentioned.
You might need to use sum rather than count depending on the type of your login_attemps column.
You'll then be able to see that value using a simple KPI chart
Use charts to make the computation:
You could use a gauge chart.
Using the sum of successful attempts as value and sum of attempts as target. The chart will compute the percentages itself.
Donut charts and Pie charts will work in a similar fashion.
Finally, horizontal or vertical stacked 100% bar charts might be another alternative.

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 😉

How to hide/unhide one of two lines in a same plot?

I have a plot with two lines. The data ranges are very different in both lines. It I put them into a single plot without any further formatting, then one of these lines will look like a streight lines in the bottom of a plot. This happens because this line is composed of values 101, 99, 102, ..., while the second line is composed of values 10002, 12000, etc.
Is it possible to place both of these lines in a sinlge line plot? I wanted to use a dual Y axis. Or maybe there is an option of hiding/unhiding lines (with automatic rescaling).
Thanks.
Sadly, the line chart does not support dual axis at this time. Another out-of-the-box visual, the bar-line combo, can. Otherwise, there are a few work-arounds you can employ.
So, this depends a bit on your data model. When your two lines are each a series (a column) of their own, then there is no way to make a line hide or 'disappear.' However, if the lines are generated as a result of being split by a legend, then you can definitely filter one of them away, just by making the 'type' field used in the legend as a slicer.
But if you've got your data in distinct series (maybe they're from different tables or dissimilar things that don't belong in the same column), you can cheat a bit by creating a new measure and applying your scale transform there. So, if your 1st line was gadgets and your second line was widgets, and you created a new measure or column 'hundreds of widgets' = widgets / 100, then these two would graph nearby on the same chart. It's pretty much the same thing, if you think about it.
So, there's some food for thought. Good luck!

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

Google charts API - multiple charts on the same image

Is there a way to display multiple charts on the same image using Google Charts api?
To elaborate:
I have one data series which I want to display as bar chart.
I have another data set which has nothing to do with the first one (well they are correlated but the values are hundred times bigger).
X-axis is for dates.
I want to have second data set displayed as line chart with Y-axis on the left.
I found something similar in "Compound charts" section but as far as I understand markers are calculated based on already displayed data set - and I want to have them independent.
In other words - is it possible to make image like this:
http://chart.apis.google.com/chart?cht=bvg&chm=D,0033FF,1,0,5,1&chs=200x150&chd=t1:30,10,20|60,40,50&chxt=y
but with the line being independent and their values axis being on the right.
I'm sorry I'm not familiar with the terminology - I'm sure there is a name for what I'm trying to achieve.
Thanks!
Only 2 years behind the curve but just to let you know that I have achieved your objective of displaying 2 datasets (one a bar chart, the other a line chart) against 2 different axis scales.
The devil is in the scaling parameter &chds and explicit axis values using &chxr. Essentially, I defined the explicit scales for the x-axis, y-axis and r-axis. and then instructed the scaling parameter to scale each dataset differently.
So for an r dataset between 0 - 10 and a y dataset between 0-2 I would write;
&chds=0,2,0,10 (y then r defined in my axis parameter, i.e. &chxt=y,r)
...and...
&chxr=0,0,2|1,0,10
Let me know if you need more detail!
I've looked into something similar to this before and have used the google chart API a lot. I'm 90% sure the answer is no. Sry :(
Yep it is possible.
Here is an example of two datasets displayed on the same axes. 1 is a bar chart the other is a line graph....
This line - chd=t1:95,1,1,3,10,3,77|95,52,44,24,11,2,1 - allows for the two datasets.
slothistype