How to make chart ignore filter in matrix headers? - powerbi

I am trying to make a chart with indicators that are alsoe headers of a matrix. My dataset has 4 variables (Date, Indicators (A,B,C,D), Currency and Value). I have a matrix where the rows are the "Currency", the columns are the Indicators A and B and the values are "Value". In my chart, the x axis is Indicators (C and D), the legend is the "Currency" and the values is "Values". I want to make this chart ignore what is selected in the matrix columns but I need it to be responsive to the matrix rows (currency). I tried some filters but it didn work.
In the Fig 1 (link below) we can see the screen if no filter is selected. And I want to select a currency (row) or a value in the matrix. But if I do it, my chat turns blank (Fig 2) where I want to see the values of C and D for the selected currency.
How can I do it?
All data and pibx are here!
Tks

Look at using the All() function, this restricts filters from affecting your measures

Related

Conditionally format a table based on average of dataset, but adhering to slicer selections

I have a simple CSV data set such as this.
ID,MainCategory,SubCategory,Type,Value
1,E,E1,Demo,5
2,N,N3,Install,2
3,E,E1,Demo,4
4,E,E2,Install,7
5,D,D1,Install,3
6,S,S2,PM,4
7,N,N2,Install,7
8,N,N2,Demo,1
9,E,E2,Demo,2
10,D,D2,Install,6
11,D,D3,PM,4
12,S,S1,PM,8
13,N,N1,Install,5
14,S,S3,Install,8
15,S,S1,Demo,9
16,E,E3,Demo,5
17,N,N2,Install,3
18,E,E2,PM,6
19,D,D2,PM,6
20,N,N3,Demo,6
21,S,S2,Demo,7
22,E,E3,Install,2
23,S,S1,Install,4
24,S,S2,PM,8
25,D,D1,Install,5
In my Power BI Desktop, I'd like to load this into a table, and conditionally format the Value column based on whether the value in each row is greater than or less than the average for the currently selected data set.
For instance, the average of Value considering the entire table is 5.08, so if there are no filters applied (as in, all my slicers are set to select nothing), I'd like all rows whose Value is 6 or more to be background colored in one color, and the others in another color. For this, I created two measures like so:
AvgOfVal = DIVIDE( SUM(G2G[Value]), COUNTA(G2G[ID]) )
BGColor = IF(SUM(G2G[Value]) > [AvgOfVal], "Light Pink", "Light Blue")
Then I tried to apply the BGColor measure for conditionally formatting the background, but this doesn't work as expected, and instead produces the result below.
I realize that this is due to the fact that the measure is calculated per row, so when conditional formatting is applied, as seen in the AvgOfVal column in the table, it calculates average per row instead of for the entire data set. How can I calculate a measure that takes into account the entire data set (considering slicers), and do the conditional formatting as I need.
Please keep in mind that if a user were to select a slicer filter (say, MainCategory = D), then I want the conditional formatting to reflect this. So in this case, given that AvgOfVal = 4.80 for MainCategory = D entries, I'd like all rows whose Value >= 5 to be in one color, and others in another color.
I realize that this is due to the fact that the measure is calculated per row
Yes. The key is understanding how that happens. When the measure is calculated a "context transition" happens and the current row is added to the filter context.
So what you want is a calculation that removes the row filter that was added in the context transition. So you need ALLSELECTED(), which does precisely that. eg
AvgOvVAl = CALCULATE( AVERAGE('data'[Value]), ALLSELECTED() )
Removing the "innermost" filter which in this case is the filter on the row, but leaving all other filters, ie filters added on the report, page, visual, or filters coming from interactions with other visuals like slicers.

Only displaying "tallest" bars in bar chart

I am trying to create a clustered bar chart in PowerBI Desktop, where only the N "tallest" bars are displayed.
My dataset consists of a small number of rows but a large number of columns.
I have tried the following:
Transform the table in absolute values (since I am interested in bar height, not negative/postive strictly)
Try to apply the "top N" filter on the axis datafield
However, nothing happens. The chart currently looks like this (without applying the transformation of the absolute value): Clustered bar chart
I basically want the same chart, but only display the N tallest bars.
You might have to pivot your table, so you have a "column name" field and a "value" field.
Then you need to use the TOP N on the Legend field, like this:
Filters:
Result:

Creating Visual on Line and Clustered Column Chart

I have line and clustered column chart (shown on "Graph" image) and I want to add a visual like drawn on "Graph" image
Clustered Columns : Planned Labor Data and Actual Labor Data
Lines : Cumulative Planned Labor data and Cumulative Labor Data
I keep data for both planned (P_Planned_Labor) and actual (Z_Labor) in 2 column table (date and data). Also I have a Date table (Z_Tarih) and it has only dates which has relation with planned and actual tables.
Dax Measures:
[Toplam Bugdeted] = Sum of Planned Bugdet
Columns;
Labor_Earned % İlerleme = DIVIDE(sum(Z_Labor[Değer]),[Toplam Budgeted],0) "percentage of actual labor of this week)
Labor_Plan % İlerleme = DIVIDE(SUM(P_Planned_Labor[Değer]),[Toplam Budgeted],0) "percentage of planned labor of this week)
Lines;
Labor_Earned Küm. % İlerleme = DIVIDE(CALCULATE(SUM(Z_Labor[Değer]),FILTER(ALL(Z_Tarih),Z_Tarih[Tarih]<=MAX(Z_Labor[Tarih]))),[Toplam Budgeted],0) "percentage of all actual from begining"
Labor_Plan Küm. % İlerleme = DIVIDE(CALCULATE(SUM(P_Planned_Labor[Değer]),FILTER(ALL(Z_Tarih),Z_Tarih[Tarih]<=MAX(Z_Tarih[Tarih]))),[Toplam Budgeted],0) "percentage of all planned from begining"
the chart i used doesnt allow (or i couldn't figure it out) to add visual which show difference value among lines.
Is there any chart that allow me to do that ?
or what measure should i add ?
Graph
Data
I think you simply can't achieve a chart like that (in which you plot the difference in that way), you will have to find a different way to show it.
for the difference itself, just create a measure like AB difference = [Measure A] - [Measure B], let's call it "difference"
Idea 1
you can then show the "difference" in the tooltip section, it will be visible only on hover (and you can put there as many differences as you want, one for "earned" and one for "planned"
Idea 2
Use the "Line and Stacked Column Chart", split the current chart in 2
In the "column values" put "labor" and "difference"
in the "line values" put the total value
This will allow seeing the current value and the difference like you asked BUT you won't be able to have multiple "categories" of measure in the same chart, as all the values will be stacked. therefore you will need to have one chart for "labor earned" and one for "labor planned".
You might want to put the 2 chart side by side (or one below the other) and maybe with a somehow fixed scale in order to make the comparison between the two easier

Don't Summarize Option Problem In Power BI

What I Have?
So, I have 4 Columns, First is Date type which will be Axis Value (X- Axis), 3 Decimal Type Value (Values Field) which will represent as Line Chart i.e. 3 Lines inside the chart.
Problem?
When i drag and drop the Decimal Type Value inside the Values Field in Line Chart, it takes as SUM.
I already selected Don't Summarize in Column tools tab with Uncategorised as Data Category.
The problem is when I click the down arrow in the Values Field, it doesn't shows "Don't Summarize" Option.
Now I need my data as it is, no sum no count, nothing.
How Can I achieve that?
There is chance to duplicating the values so you might get more value than the present value. So have to create new table using below DAX then apply to you visual.
DISTINCT(SUMMARIZE(ResellerSales_USD
, DateTime[CalendarYear]
, "Sales Amount (USD)", SUM(ResellerSales_USD[SalesAmount_USD])
)

power BI diaplay one value

I am using Power BI to bring together data from several systems and display a dash board with data from all of the systems.
The dashboard has a couple of filters which are then used to display the data relating to one object across all systems.
When the dashboard is first loaded and none of the filter have been selected, the data cards display information from all rows in the table.
Is there a way to make a data card only display one row of data?
or
Be blank if there are more than one row of data?
There's no direct way to look at the number of rows in the visual, count them, and do something different if there's more than 1.
That said, there are a few things you can do.
HASONEFILTER
If you have a specific column in your table that, when selected, filters your results to a single row, then you can check if there's a filter on that column using HASONEFILTER. (If you have multiple alternative columns,any of which filter to a single row, that's ok too.)
You could then create a measure for each column that tests HASONEFILTER. If true, return the MAX of the column. (The reason for MAX is because measures always have to aggregate, but the MAX of a 1-row column will be the same as the value in that column.) If false, return either BLANK() or an empty string, depending on your preference.
E.g.
ColumnAMeasure = IF(HASONEFILTER(Sheet1[Slicer Column]),MAX(Sheet1[COLUMN A]), "")
ColumnBMeasure = IF(HASONEFILTER(Sheet1[Slicer Column]),MAX(Sheet1[COLUMN B]), "")
where Sheet1 is the name of the table and "Slicer Column" is the name of the column being used as a slicer
HASONEVALUE
If you have multiple columns that could be used as filters in combination (meaning that having a filter applied on "Slicer Column" doesn't guarantee only 1 row in the table), then rather than testing HASONEFILTER, you can test HASONEVALUE.
ColumnAMeasure = IF(HASONEVALUE(Sheet1[COLUMN A]),MAX(Sheet1[COLUMN A]), "")
ColumnBMeasure = IF(HASONEVALUE(Sheet1[Column B]),MAX(Sheet1[COLUMN B]), "")
Notice that HASONEVALUE tests the current column you're trying to display, rather than a slicer column like HASONEFILTER.
One side-effect of HASONEVALUE is that, if you're filtered to 3 rows, but all 3 rows have the same value for column A, then column A will display that value. (Whereas with HASONEFILTER, column A would stay blank until you're filtered to one thing.)
Low Tech
Both answers above depend on a measure existing for every column you want to display, so that you can test whether to display a blank row or not. That could become a pain if you have dozens of columns.
A lower-tech alternative is to add in an additional row with blanks for each column and then sort your table so that that row always appears first. (And shorten your visual so only the top row is visible.) Technically the other rows would be underneath and there'd be a scrollbar, but at least the initial display would be blank rather than showing a random row.
Hopefully something here has helped. Other people might have better solutions too. More information:
HASONEFILTER documentation: https://msdn.microsoft.com/en-us/library/gg492135.aspx
HASONEVALUE documentation: https://msdn.microsoft.com/en-us/library/gg492190.aspx