Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rogletree
Helper III
Helper III

Need help getting certain values from a specific related table

I have two tables. One of them is called "date_hours" and it currently has only one column called "date_hour" that has rows for the 24 hours of the day for each date in my data set as date/time type(so 24 rows  * number of dates rows). My other table is "availability_%" and has three columns; "machine" which holds a text of the machine name (there are 6 different machines), "date_hour" which is the same as that column for the other table (but for each machine, so 6 rows * date_hours rows), and "availability_%" which is the percentage of time that machine was available during that specific hour of that specific date.

 

What I would like to do is add columns to my "date_hours" table, a column per machine, that holds their availability % for each date_hour. So one column for MachineA, one column for MachineB, etc. These two tables have a one-to-many relationship based on the "date_hour" field.

 

Now, I know I could do this in power query by duplicating tables, removing certain rows, then merging them back together, but I would rather do this with a DAX expression, I just don't know what that expressoin would be.

 

Any help?

2 REPLIES 2
alfranco17
Advocate I
Advocate I

It seems like you have everything you need on the availability table.

You could use a matrix visualization (or Pivot Table, in Excel), and place [date_hour] on rows, [machine] on columns, [availability_%] on values and slice by date (I am guessing you have a date field in there too), you could get the table you described. No need to create a new table.

@alfranco17 

It's true that I have everything I need on that table. But the reason I am trying to do it this way is for plotting graphs. Unless I am misunderstanding you, I don't think that can be done with what you described (at least not the kind of graphs I want to have). 

I already have some graphs. The first one shows the date on the x-axis with the total duration of machine downtimes on the y-axis, then you can drill through for a specific date and see the downtime durations for every hour of the day for a specific date. My goal is to change that second graph into a line and clustered column chart where the column values remains the same as it was before (total downtime duration for all machines) and there are individual lines for each specific machine representing their availability %.

But if I can't figure out how to do what I'm trying to do, I'll consider your suggestion!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.