Row Formatting In Power BI - powerbi

I am having a dataset of multiple products with it's average rating over the months.
I want to ask how can we do row formatting for example: If the rating of a product keeps on increasing, color it with green else if it's decreasing it should have red color.
I want all this to be done in Power BI.
Sample Data:

With this format of the data, you will have to create a measure for each of the columns you want to colorize. Here are the measures (assuming Table is the name of your table):
June background = IF(SUM('Table'[June]) < SUM('Table'[May]), "RED", "GREEN")
July background = IF(SUM('Table'[July]) < SUM('Table'[June]), "RED", "GREEN")
August background = IF(SUM('Table'[August]) < SUM('Table'[July]), "RED", "GREEN")
September background = IF(SUM('Table'[September]) < SUM('Table'[August]), "RED", "GREEN")
Add a table visual to the report with the columns from your sample and for June to September repeat the following. Right click the column in the values pane and select Conditional formatting -> Background color:
This will open a window, where you can select how to determine the formatting and shall it apply it to values only, totals only or both. Select to format it by field value and choose the corresponding measure for the column, like this:
Repeat that for the rest of the columns to get this result:
For more information, take a look at Use conditional formatting in tables article.

Related

Power BI: How to conditionally format a row of a table in Power BI DAX

I am new to DAX and I need help to colour the background of a row in table using DAX.
Name
text
Book
Ora
Pencil
hjui
I want to colour the entire row of table with Name = Book in ORange
Can someone help me
Yes, it is possible using conditional formatting.
In the Fields pane, right click your table and create the following measure:
Background color = IF(MAX('Table'[Name]) = "Book", "Orange", BLANK())
Then select the table visual and in Visualizations pane, right click each of the columns and select Conditional formatting -> Background color:
In Format by select Field value and select the above created measure in Based on field:
After you do that for each column shown, the result will be as follows:

Can legends in PowerBI Pie Chart be hidden if value is zero?

In a Power BI Pie Chart total 8 legends(category) are there and count is distributed by category as shown in 1st pic. When I select Only June 2020 (2nd pic), there is data only for 5 category and accordingly it is distributed in Pie Chart. In both images, there are 8 legends are shown in right side.
Is it possible to hide the legend if there is no value for that legend. for example : in 2nd image, possible to hide remaining 3 legends and only shown legends for which data is there?
First create a measure using the following dax function:
Cross Filter = INT( NOT( ISEMPTY( FAC_TABLE ) ) )
Select your visualization, open the filter panel and drag the measure in the Filter on this visual option. Finally select the option equal to 1. The following image is in spanish but you will get the idea.
Hope it helps.
As suggested by Agustin I created below measure:
FilterMeasure = INT(NOT(ISEMPTY(Filter(TableName,TableName[Category]=TableName[Category]))))
and below is filter pan:

PowerBI - conditional formatting for highlighting weekends

I have a data table matrix in power bi showing Dates in Rows and hours in columns and count of customers against them as values. i wanted to highlight all rows of thursday, friday and saturday, so that weekend figures can be compared.
Need help in this pls...
the table is in the below format
enter image description here
First you want to create a duplicate (in my case monday - friday (2) that does NOT have a relation to you source table. You want this duplicate table to only show days. This duplicate table needs a relationship with the slicer you are going to use to filter for days
In your source table (monday - friday) you want to create the following measure:
Measure = IF(HASONEVALUE('monday -friday (2)'[Day]);
IF(SELECTEDVALUE('monday -friday (2)'[Day]) = MAX('monday -friday'[Day]); 1; 0);
IF(ISFILTERED('monday -friday (2)'[Day]) && COUNTROWS(FILTER('monday -friday (2)'; 'monday -friday (2)'[Day] = MAX('monday -friday'[Day]))); 1; 0))
Now you want to create conditional formatting. First create your table with days and values (for the example i did not sort the table. You want to sort your table so it looks better):
Then right click on values and select conditional formatting. Select based on rules.
and the measure you just created in your source table.
for the first option you select "is bigger than or equal to" and give it a value 1.
for the second option you select "is smaller than"and give it a value 1000.
Choose the color you want your highlights to be.
If you now select a day in your filter the value for that day will show the background color you selected! In your case you want to select all days you want to have highlighted.
Hope this helps!

Display year,quarter,month and day Charts based on the selected Date

There are four line charts for Year,Quarter,Month,Day in my power bi report. the requirement is to pick a date from the date picker and based on the selected date I need to display graphs accordingly(selected date and 3 values back). E.g. if user select 1.1.2018 from date picker, I need to display graphs with year,quarter,month,day belong to 1.1.2018 and 3 more values(years,quarters,months,days) back.
I add visual level filters for each line chart and filter top 4 values.but it's work for year chart only. any ideas?
Dashboard_1
Dashboard_2
Data
Hey Dasaru try to create separate columns for year, quarter, month & date and use that as Axis in each chart
FYYear = Sheet1[Period].[Year]
FYQuarter = Sheet1[Period].[Year]&" "&Sheet1[Period].[Quarter]
Apply the same solution for Month and Date.

Power BI chart to highlight and compare any three periods of data

Does Power BI have a chart that can highlight to compare three periods? In this case, they are current month, previous month, and the same period last year.
I have the three measures ready but couldn't find a chart type to highlight the periods I want to compare and grey out the rest.
I believe the key here is using a measure on the chart's color saturation field.
I was able to achieve the following where the bar colors are dependent on the date slicer:
I defined my measure like this:
Color =
VAR SelectedDate = SELECTEDVALUE(Cal[Month])
RETURN 0.5*(EOMONTH(SelectedDate, -12) IN VALUES(MTS[Date])) +
0.8*(EOMONTH(SelectedDate, -3 ) IN VALUES(MTS[Date])) +
1*(EOMONTH(SelectedDate, 0 ) IN VALUES(MTS[Date]))
where MTS is a monthly time series table and Cal is an unrelated calendar table that only has month ends. Only one of the conditions holds at a time and the constants in front just define where on the color range the result will land when the condition returns TRUE() (which gets coerced to be 1 when multiplying).
Once you've put a measure on the color saturation field, you can access the data color settings under the Format section:
If you are just looking to highlight three measures manually to distinguish from the others you can go into the Format tab, and under "Data colors" you can toggle on the "Show all" option and change them there.
You could also use a slicer.