Read value from a different table for Y-axis constant line in Power BI - powerbi

I have a scatter chart and a db view to get the necessary data from it. This view only returns the names and its's respective values and is enough to make my chart just fine. Problem is that i want to draw a Constant Line on my chart but i want to read its value from a configuration table that i have in my DB. Currently when i try to add the Y-axis constant line in power bi, it only allows me to type the static value and it won't get the data dynamically from somewhere else; a different key-value based table that i already mentioned above. How can i achieve this?
Here's the images:
Thanks in advance.

There is not direct solution for this problem but this workaround did the job for me:
Create a measure (may work with a calculated column that will later be summarized as average, MAX, MIN, etc.). The measure (or aggregation of calculated column) will have the dynamic value of the constant line you want to display. In my case, I used a measure and I am showing a constant line that changes value depending on the current month.
Create your visual without the constant line first. In my case, I am using the clustered bar chart.
Add the measure with the constant value to your list of values of the visual. The value will appear in your visual. In my case, it appeared as another horizontal bar. You'll hide it in a later step.
Go to the analytics tab of the visual and instead of adding a new Constant Line, add a Min Line, Max Line, or whatever line makes more sense for your measure, column, visual, etc. as long as the option you choose allows you to select the measure/column you added in the previous step. From the formatting options of the line you added, click on the dropdown labeled "Measure" and pick the measure that has the value of the constant line.
Finish formatting the line as you want (title, text position, color, etc.).
Go back to the Fields tab of the visual and drag the measure with the constant value from the Value group to the Tooltips group. The value will now disappear from the visual but the constant line should remain.
(optional) If you do not want the value of the now dynamic constant line to show in the Tooltip of the visual, create a custom visual. However, keep in mind that if the user is viewing the report in a way that doesn't support report page tooltips, the user will see the default Tooltip including the value of the dynamic constant line you just created.

Related

Power BI Combine Value Plus Unichar In a Tabular Report

I have one tabular report to track the performance according to the month... if the difference is in positive values then need to show "GREEN UP ARROW" icon and if the difference is in negative values then need to show it in "RED DOWN ARROW".
Required the above output into one single column not in to multiple column like in the below screenshot
I have tried the UP and Down Arrows in my report but I am unable to get the result in to one column.
You can use conditional formatting to achieve this. Edit Cell Elements on your visual, turn on Icons for the required series, then set the icon options as follows:
This displays as:

How would I conditionally format the font color for an unsummarized field in Power BI?

I have a numeric field in my data source that is unsummarized. There is no aggregation on this field.
I would like to format this field to use a red font color whenever the field value is greater than or equal to 100.
Otherwise, I would like the font color unaltered.
I cannot seem to find a way to do this in the Power BI Conditional Formatting dialogs.
If I try:
Format By: Field Value
Apply To: Values Only
I cannot select the field in the Based on field. It is grayed out.
If I try:
Format By: Rules
Based of Field:
It immediately plugs a 'Count of ' aggregation qualifier on the field. There is no way to turn off the summarization.
I simply want to use a red font color if a field value is greater than or equal to 100. Is there any way to do this in Power BI?
Unless you are using your field as a dimension (e.g. row/column header or the x-axis on a chart), it's pretty much always going to be aggregated (summarized) inside the visual, even if it only has a single value. If you have a single value, then MAX, MIN, SUM, AVERAGE should all return the same value and you can use any of them as your summarization.
The automatic summarization of a field is called an "implicit measure". You generally have more control writing your own explicit measures. For times when I know that I only want a single value, I tend to write explicit measures like this
FieldValue = SELECTEDVALUE ( Table1[Field] )
The advantage of this over MAX or SUM is that I get a blank when there are multiple values, alerting me that something has gone wrong.
Explicit measures like this will show up as options to use in the conditional formatting interface.
More information on implicit and explicit measures:
https://radacad.com/explicit-vs-implicit-dax-measures-in-power-bi
https://towardsdatascience.com/understanding-explicit-vs-implicit-measures-in-power-bi-e35b578808ca

Is there a way that POWERBI does not agregate all numeric data?

so, I got 3 xlsx full of data already treated, so I pretty much just got to display the data using the graphs. The problem seems to be, that Powerbi aggregates all numeric data (using: count, sum, etc.) In their community they suggest to create new measures, the thing is, in that case I HAVE TO CREATE A LOT OF MEASURES...Also, I tried to convert the data to text and even so, Powerbi counts it!!!
any help, pls?
There are several ways to tackle this:
When you pull a field into the field well for a visualisation, you can click the drop down in the field well and select "Don't summarize"
in the data model, select the column and on the ribbon select "don't summarize" as the summarization option in the Properties group.
The screenshot shows the field well option on the left and the data model options on the right, one for a numeric and one for a text field.
And, yes, you never want to use the implicit measures, i.e. the automatic calculations that Power BI creates. If you want to keep on top of what is being calculated, create your own measures, and yes, there will be many.
Edit: If by "aggregating" you are referring to the fact that text values will be grouped in a table (you don't see any duplicates), then you need to add a column with unique values to the table so all the duplicates of the text values show up. This can be done in the data source by adding an Index column, then using that Index column in the table and setting it to a very narrow with to make it invisible.

How to show value in only first cell in case of duplicate Power BI

I wrote a query in Power BI which returns results like this
Is it possible: For the first column Service Name if value is same in cells than to show value in the first cell and than leaves all the other cells blank until the value is changed, If the new value is repeating than again leave all the cells blank until a new value found
All you need to do is to change the table visualization to matrix visualization.
Just keep the column under the Rows section.
The matrix visualization will then group and hide the repeating values automatically.
For me, when I switched to a Matrix visualization, it displayed all fields in a single column with plus signs to view detail. To show each field in a separate column, go to "Column Headers" and turn off "Stepped layout".
Use Matrix visualization
Add Service Name and Ticket Type into the Rows
Drill down the visule
go to setting, and under Row Header, remove Stepped

Power bi box and whisker: filter with an if statement

MWE set up:
1) From the Power Bi visual website: https://app.powerbi.com/visuals/ there is a custom download "Box and Whisker (Jan Pieter)"
2) Download sample.
3) create new measure with dax formula:
Distinct count score = if(distinctCOUNT(Courses[Score]) > 4, average(Courses[Score]), Blank())
4) Add a Stacked column chart with Course as the axis and the newly created 'Distinct count score' as the Value and get the following:
5) compare this graph to the Box and Whisker provided by Power BI:
Here is my problem. I only want to show values in the Box and Whisker where the Distinct Count of Scores is greater than 4 -- So I only want Physics to show up (like the stacked column chart above).
So if I try the solution working with the stacked bar chart using the Dax formula. I get the following--nothing shows up:
And this is what I want to happen:
Question:
Is there a way in Power BI run and distinct count statement within a Box and Whisker chart to only show data with > 4 distinct values (or any if statement)?
I want it to be formula based, I cannot just 'visual filter' items I do not want.
Possible answer:
I thought about going to the source code to try and 'throw in' a if statement. But I went to the developers git hub: https://github.com/liprec -- I couldn't find the repo for this visual.
Basically this is due to the way the box and whisker chart is working. The visuals needs a dataset to calculate the values (mean, median, etc.) and use those values to show the box and whisker.
So in your case you need to create a measure that is on the same level as the scores (because those values are needed) and is only available. See the screenshot for a visual explanation of the needed measure.
I created the measure with the follow DAX measure:
Filter Score = IF(CALCULATE(DISTINCTCOUNT(Courses[Score]), ALLEXCEPT(Courses, Courses[Course]))>4, MIN(Courses[Score]), BLANK())
The Boolean expression of the IF statement calculates the distinct scores per course via a CALCULATE expression and the ALLEXCEPT filter option to ignore everything but the course value. And the TRUE part returns the score which needs to be aggregated, so the MIN and the FALSE part return a BLANK() value so is can be ignored.
When you add the new measure and create a BW chart it will only show 'Physics' course results.
If you need more help, please let me know here or via email.
-JP
BTW: I just updated my PowerBI visual GitHub repository (https://github.com/liprec/PowerBI-custom-visuals) and added my box and whisker chart and my hierarchy slicer to it in the folder oldAPI.
The crux of your problem, as far as I can tell, is that you want to filter visuals to courses that have a particular number of distinct values. Which visual you want to use is almost irrelevant (though it was helpful to have a sample Power BI workbook to follow along with).
The way I'd approach this (and not saying this is the best or only way)
Step 1
Create a new Course dimension table, with one row for each unique course. In the sample workbook, you can click 'Enter Data' and manually type in the data.
Course
------
English
Math
Physics
Step 2
Next, create a calculated column in the new table and calculate the distinct count for each course. This isn't a measure - it's a column in your table, that uses the Distinct Count calculation from your question.
Distinct Count = CALCULATE(DISTINCTCOUNT(Courses[Score]), SUMMARIZE('Courses','Courses'[Course]))
The SUMMARIZE works like a GROUP BY. In essence, creating one row per course with a distinct count of scores.
Step 3
Use this new attribute as a filter on your visual. You can then dynamically alter the number of distinct values as you feel like (4, 3, 2).
I know this isn't quite as good as typing a formula into the visual filter field, though in practice it's still formula driven. The formula is just on an underlying table.
Why so complex?
The reason you have to do this for the Box & Whiskers visual, whereas your 'Distinct Count score' measure works so well, is that on the column chart, you are displaying a single value (the average score). The Box & Whiskers chart, by contrast, is plotting every individual score.
In fact, if you removed the 'Course' from the axis of your column chart, the value changes as it adds back in the courses you filtered out. (The reason for this is that, if no course is on your axis, your formula calculates the distinct count of all the courses, which is 7). Likewise, if you were to filter your column chart to a particular session, your column chart would go blank (since in any given session, no course has more than 4 distinct values).
The technique I've described above fixes those problems, because it filters out the courses Math & English from the get-go. It doesn't matter if you've filtered to a single session, or not filtered by course at all. English & Math will always be excluded as long as their distinct count is below the value you specify.
Hope this helps.