Power BI Visualization Points from columns - powerbi

I have the following SharePoint Lists:
Plans:
Plan
Curve
Description
Plan001
Curve001
asdf
Plan002
Curve002
asdf
Curves:
Curve
ValueA
MeasureA
ValueB
MeasureB
Curve001
10
100
50
100
Curve002
20
30
40.
80.
A User can select a Plan in Power BI. When the plan gets selected, I want to draw a Visualization of the corresponding curve E.g. when Plan001 gets selected, Curve001 should be drawn. The Points consist of the Values (X-Axis) and Measures (Y-Axis)
I managed to get all the values with either measure column or calculation column. But I am not able to draw the line chart. This is probably because each field in the curve table is also a own column.
The chart works perfectly if I create a table like this from hand:
Value
Measure
10
100
50
100.
Is there any way to transform the table, measure columns or calculation columns to such a table automatically? Or do you know a way how I could achieve this?
Unfortunately, I can't change the SharePoint list.

Related

Problems calculating percentage of subtotals in PowerBI

I'm having problems with a line chart calculating the percentage of subtotals. What I have at the moment is as follows:
The PowerBI Data is structured similarly with a few extra columns.
I want to do a line graph where for each quarter, I have the percentage of each result for that quarter. For example, In Q4, between Business Unit A and B, I have 45 Passes, 2 Partial Passes, and 19 Fails. so of a total of 66, Q1 should show 68% pass, 3% partial pass, and 29% Fail. When I do the chart in Excel, I get the following (which is what I want to replicate in PowerBI):
In order to build this in PowerBI, I'm using a measure with the following formula:
Percentage = DIVIDE(SUM('TABLE NAME'[Number]),CALCULATE(SUM('TABLE
NAME'[NUMBER]),ALLEXCEPT('TABLE NAME'[DATE].[QUARTER])
When I use that formula, if I filter on an individual quarter, the chart values are correct, but when more than 1 quarter is displayed, the percentages are incorrect:
1 Quarter displayed:
Full Chart Displayed
The percentages between the chart in Excel and PowerBI are off when multiple quarters are displayed in PowerBI. I can't for the life of me figure out how to get the chart to be correct.
Any help would be tremendously appreciated.
Thanks!

Dynamically Change Y Axis Size Based on Slicer

I have a spreadsheet that has information on credit card applications. In Power BI, I have created calculations to calculate the number of applications (COUNT), and other calculated measures that give me the number of applications based on different filters (CALCULATE).
I then created a slicer that slices the data based on type of card. So say I have a line chart that shows the number of applications for males and females, I can then use the slicer to select different cards.
The trouble I'm running into, is that some cards have a lot more applicants than another. This can be difficult for display, as I set certain Y Axis ranges for the data labels to be clear. So if I have one line chart that the minimum is 100 and max is 500 for one card, if I click on another card in the slicer, then the Y axis size is still 100 - 500, which isn't great if another card in the slicer pane only has 50 applicants.
Does anyone know of a creative way to dynamically change the Y Axis sizes, based on a slicer selection?

Can we do conditional formatting in Power BI using DAX?

I have a KPI which I need to conditional format based on a dynamic condition.
Example:
KPI : A
if A > Average of A in that cluster(A column present in the table) then the cell should be RED
if A lies between some values then the cell should be AMBER
if A lies below some value then the cell should be GREEN
I was doing conditional formatting by RULES prior to this but I cant seem to find an option there which can dynamically calculate the Average cluster total or Average country total and format the cells with colours.
Even if I make this DAX expression how do I put it in the table?
Also, is it even possible by DAX?

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

ColdFusion Chart x-axis label limits

I'm using cfchart tag to draw my line chart in ColdFusion.
My x-axis range is from 1 to 24 and it is fix number of labels for all my charts.
But in my chart, I may have values for first 10 (or any fix number from 1 to 24) points. I mean, my query row count will be 10.
So query with 24 points will show full graph ad query with 10 points will show x-axis values from 0 to 10. But I want to scale the chart for 24 points regardless of query count.
cfchart has an option called scaleFrom and scaleTo to fix the y-axis series, Is there any option for x-axis series?
Following is a chart and it should scale it for 24 points on x-axis (lines from the 10th point will not be there).
<cfchart format="jpg"
xaxistitle=""
yaxistitle="" chartwidth="600" chartheight="120">
<cfchartseries type="line" paintstyle="shade"
query="qChart1" markerstyle="circle"
itemcolumn="CHARTLABEL"
valuecolumn="INTCHART1" />
</cfchart>
I think you are looking for
xAxistype="Scale" scaleMin="1" scaleMax="24"
xaxistype normally defaults to "category" which I believe is simply the query in order, but by setting to "scale" (must be all numeric values) you can alter this.
If you are wanting more custom formatting for charts fire up webcharts.bat in the charting folder of CF and fill your boots.
Saul's answer is more elegant than mine, but I'll still share.
I had the same problem with showing monthly activity for the last year. Sites that had only been active briefly, or who had no traffic/growth/whatever I was tracking didn't display correctly.
Instead of using a cfchartseries displaying a query, I looped over the time to be displayed, used a query of queries to extract the data for that month, and then added a data point for that month.
A bit brute force, but it worked.