Highlight high to low numbers in a row in PowerBI - powerbi

i have a table, Partner Group is common from one excel file
then i have 4 more files with dates: dec '18, dec '19, jan '20. feb '20
the four excel files in powerbi are connected via the partner group file.
i have no idea how to get it to highlight the row based on high to low. i have tried many ways but it wont work

Related

Seperating Duplicate Values in Multi Info Cards On Power BI

Been struggling with a problem and can't seem to get past it.
Trying to express the sample table below as Multi Info Cards.
Year
Description
Score
2018
Work Description One
25
2019
Work Description Two
21
2021
Work Description One
12
2019
Work Description Three
19
The cards need to display the description column based on the scores column. Currently row one and row three are combined due to having the same description, showing a sum value of 37.
The easiest way to differentiate would be based on the year but I am having trouble creating a measure/filter to achieve that.

Power BI Rolling 12 Months nothing to calcuate?

I have an access database I am pulling data from. It has data going back to 2015 but I only want the data from the most complete 12 months. Today is 9/27/2021 so I would want data from September 2020 to August of 2021.
Sample data:
Date
Level
8/12/2019
Level 1
1/26/2021
Level 3
6/13/2020
Level 4
4/12/2021
Level 1
3/7/2015
Level 2
4/16/2021
Level 2
I want a simple bar chart where it has the month/year and the count per level
You can use relative date filtering is in the last 12 calendar months.
Here's what that looks like for today (9/28/2021):
Click your visualization on power bi desktop, expand date filter,
add 1 year
or you can add filter from transform data tab in power bi desktop

Moving average line in line chart Power BI

I have built a line chart using two filter conditions and want to include dynamic average line to the visual. Like for example I need to show the average line based on two parameters, first is date i.e. 21st Jan - 25 Jan and the site locations selected, it will only consider average between 21st to 25th Jan and not till 4th of Feb.
The site location will also be selected to count the call volume.
I am struggling to find a way around as I I thought of using SelectedValue or switch method.
Any help will be much appreciated.

PowerBI - Selecting the Source File(XLSX) dynamically

Is it possible to pick up the source file for PowerBI dynamically.
Lets say I have a folder called as Productivity and inside that for every 2 hours a new file is saved out.
I would want the most recent file based on the file name.
Productivity-
Prod dec 21 - 1
Prod dec 21 - 2
prod dec 21 - 3
I want PowerBI to select the most recent one which is prod dec 21 - 3 and is it possible to show the file name on the report, so that they know how updated the data is?
You should be able to load a folder in the query editor. It will load a list of data files within that folder.
Sort rows by Date modified (descending), then choose Keep Rows > Keep Top Rows and set the number of rows to keep as 1.
Finally, click on the double down arrow on the Content column to drill down and return whichever table you are wanting to load.

Dax Calculation with logic in power bi data analytics

Need help in Data Analytics Calculations.
Currently, I am getting historical data for consumption as follows:
on above data, I am adding custom columns for calculating exact consumption(gallons) in no. of days. like:
Now, I have to plot month wise bar chart for consumption of respective Meter ID in 2016 year. But problem here is, I will have to calculate Every months consumption by dividing it in days in each respective month of 2016, and then only I will able to plot them monthly like:
y axis = consumption in every month
x axis = Jan Feb March Apr May Jun Jul Aug Sep Oct Nov Dec
so, in jan month, consumption should be = 10 + 100 + ((115/38) * 7) gallons
Notes: here, in ((115/38) * 7) : we are calculating avg consumption of single day 7 days in Jan and whole march and then getting last 7 day consumption of Jan so that we can add it in calculation of total consumption of Jan month
but how to add measure/custom column/new table for these calcualtions?
Thanks
What you need to do is relatively complicated, but the summary of my solution is:
Calculate the per-day consumption
Calculate the start and end date of each reading (e.g. the previous reading date plus one day, and the reading date)
Expand your data to have 1 row per day rather than 1-row per reading
You want to do these steps before you load the data into your data model (i.e. in your source system, or as the data is loaded using the Query Editor/Power Query).
Below, I assume you're using the Query Editor/Power Query. However, if you can use your source system, it's often the better choice (since the source system may be a database that is vastly faster than your desktop).
Note that your No. of Days calculation doesn't make sense to me. There are more than 38 days between 24 Jan 2016 and 31 Mar 2016. There are also more than 13 days between 10 Jan and 24 Jan. For this reason, it was difficult to tell whether you wanted a new reading to count on the day the previous reading was taken, or on the next full day. I assume the former. Also note, I've proceeded on the basis that your No. of Days calculation is correct
Calculate the Per Day Consumption
This is the easiest step, given that you have already calculated the Consumption and the No. of Days. Just divide one by the other. In the Query Editor, you can click in the Consumption (gallons) column and select Add Column > Standard > Divide. Under Value, choose Use values in a column and then select the No. of Days column.
Calculate the Start & End Date of Each Reading
The date of the reading is the end date, so you can rename Date to be End Date (since a reading is applied retroactively).
For the start date, in the Query Editor, you will need to add an index column (Add Column > Index Column). You will want to make sure your data is sorted by Meter ID and Date Ascending before doing this. Call the column Index.
Next, Add Column > Custom Column and pull the reading date from the prior row. Call the new column Previous End Date for now.
// A try is necessary because we can't get the previous row if there is no previous row (we'll get an error, which we can handle in the 'otherwise' block)
try
if
// See if the previous row is for the same Meter ID
[Meter ID] = #"Reordered Columns"{[Index] - 1}[Meter ID]
then
// If it is, grab the Reading Date from the previous row
#"Reordered Columns"{[Index]-1}[End Date]
else
// If this is the first reading for a meter, calculate the Start Date by subtracting the No. of Days from the End Date
Date.AddDays([End Date], -[No. of Days])
otherwise
// If this is the first row in the table, also calculate the Start Date by subtracting the No. of Days from the End Date
Date.AddDays([End Date], -[No. of Days])
Next, you'll want to add 1 to the Start Date, as we want the reading to apply to the day after the previous reading, not on the day of the previous reading.
Note, if you want the reading date to count in the prior period, subtract 1 from the End Date rather than add 1 to the start date (previous end date).
Expand your data to have 1 row per day
At this point, you should have a Meter ID, Start Date, End Date, and per day consumption column that reflects what you expect (i.e. the per day consumption is correct for the date range).
The final step is to duplicate each row for each date in the date range. There are several solutions to this outlined in this thread (https://community.powerbi.com/t5/Desktop/Convert-date-ranges-into-list-of-dates/td-p/129418), but personally, I recommend the technique (and video) posted by MarcelBeug (https://youtu.be/QSXzhb-EwHM).
You should end up with something more like this (after some removing & renaming of columns):
Finally
Now that you have one row per meter & date, with a per day consumption already calculated, you can build a visual. For example, you could do a column chart with Date on the Axis, and Consumption per Day as the value. By default, Power BI will recognize that Date is a date, and will roll it up by Year-Quarter-Month-Day. Press the little 'x' by Year and Quarter, and you'll have a chart that sums up the per day consumption by month. You can also drill down to individual date.
Further Reading
Reading a value from a previous row in Power Query
If Statements in Power Query
The AddDays function in Power Query
Adding Comments in Power Query
Catching Errors in Power Query
Converting a date range into a list of dates (Marcel Beug's solution)
A similar problem I previously answered