Filter and calculation of duration - if-statement

I have a sheet with raw data and cannot think of the right formula. Here is how the data look like
What I want is a formula that would help me calculate the duration between the Com failure and the Com restored for every electrical panel. The issue is that the same panel could have failure and restore on multiple days and I need the formula to find the right restore for the correct failure. Hope that makes sense.
This is what I get after trying MattKing solution and it is partially correct

in column E, in cell E2, you can put this formula.
If it's a row where it's been restored, that formula should just "look up" the last "com failure" for that panel and subtract that date and time from the date and time in that row.
=IF(B2="Com restored",C2+D2-VLOOKUP(A2,SORT(FILTER({A$1:A1,C$1:C1+D$1:D1},B$1:B1="Com failure"),2,0),2,0),)

Related

Power BI - Copying data to new column before refreshing data

This is what I hope to be a very simple issue, I'm just having a hard time putting the right search terms together in order to find the answer.
Basically, I want to preserve the data from the last refresh before the data is refreshed again, in order to compare the difference.
Example:
I have a basic web scrape that runs off and grabs the latest stock price for Microsoft:
What I want to be able to do during the refresh is to first copy the current value (283.85) to a new column and then refresh the data, so that I have a side by side current and previous price.
Really tried to find an answer, but I don't think I'm using the correct terminology.
I have never used this method. Would it be easier to add a date column to your current table and make it your record table? That way you can do a comparison and visuals from your data.
If you really want separate tables you could update your table with the date column and then write a table query to get your latest stock price according to date

Power BI DAX - Measure to change name of row value

I need some help creating a measure to change the name of "FROM_USER" in the slicer here.
I think I need to use the function SELECTEDVALUE, but I have not managed to get it working.
So, the column has only two values, CRAWLER and FROM_USER.
Any suggestions would be helpful!
See picture
Measures can't be used as slicer values. If you want the column values to be changed and yet to be used in a slicer, you need to create a calculate column to change that.
Column = IF('Table'[Column1]="FROM_USER","desiredValue","CRAWLER")
If you are really keen on using a measure to slice, you need to build a disconnected table and follow the method described here. But the performance will take a hit depending on how complex your data model and calculations are.

Showing a visualization with Parent Child/Successor Predecessor relationship

I wanted suggestions from the community as to which chart should be used to depict the Parent-Child/Successor-Predecessor relationship in Power BI. I'm using Azure boards as a data source. Here is my sample data source.
I want to show each work item id in the center and its Predecessor on the top left and successor on the bottom right. With that, I want to arrange my items based on iteration.
Here is how I'm trying to visualize my data.
I don't need links to the Microsoft Custom Visuals Page. I know that it exists. I'm expecting somebody to point out to a visual in the market place that could help me with my scenario.
Not sure if there any exact option for data presentation as per your design/requirement or not. But to serve the purpose, you can try with "Multi-row card" and the presentation will be something like below-
You can apply some Styling in the visual, but it will not like your sample requirement I guess :(
Here 2 column is basically 2 different "Multi-row card" visual.
In first visual, applied filter with Iteration = 1
In second visual, applied filter with Iteration = 2
For better presentation purpose, I replaced NULL value with a "-" in column "Predecessos ID" & "Source ID Title"

Running Total By Date in Visualization

I'm trying to create a line chart visualization that shows a constantly increasing sum over time. I think this would be called a cumulative total or a running total, but most of the questions I've seen on here have been about showing a total at the bottom of a matrix, subtotals, etc. Instead, I just want to visualize the units from the previous date being added to the current date, and so on. Not sure if this would be a custom column in the dataset or if there is an existing function for this.
Any help is appreciated. Thanks!
Goto Quick Measures, in the "Calculation" dropdown, select "Totals - Running Total", pull in Base Value (what you want to aggregate) and Field (probably your calender) and here you are!

Why doesn't ALL function ignore filter when data is sliced by columns in pivot table?

I'm new to the DAX world and I just faced a conceptual misunderstanding.
While I was trying to debug a measure, I found a unexpected (for me) behaviour with the ALL function. I wrote a simple measure COUNTROWS(ALL(Table)) but to my surprise, when I sliced the data by a column, the same number did not appear in each cell in the values field, ignoring the filter context in the way I was expecting:
So, what am I missing?
Since there are no BUYs on e.g. 01/08/2017, it's not even evaluating the measure. Since that cell doesn't correspond to any rows in the original table, it's not doing any computations.
If you had a BUY and a SELL on the same day, it should show up in both columns on that day.