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
Cyprix
Frequent Visitor

Data Relationship help

Hello Everyone,

 

New user to powerbi here. I am trying to create a report that when given a list of rooms and a date period, I can show how many times each room was logged as well as the day of the week. My goal is to have my user provide a list of rooms and the date range of the week or 2 week period, and have the report show each room and how many times each room was completed as well as the day of the week.

 

My Data looks like this 

 

HospitalB

 SessionIDUploaddateSessionTypeRoomTechnicianStartTimeEndTimeStopReasonRuntimeDeviceVersionAccount 
 8477191/1/17 12:05 AMSporeOR1dossing12/31/16 9:13 PM12/31/16 10:05 PMCycle Complete31333041.9.2AHospitalA 
 8477201/1/17 12:07 AMBacteriaOR1dee12/31/16 10:33 PM12/31/16 11:07 PMCycle Complete1985511.9.2A 
HospitalB
 
 8477211/1/17 12:08 AMSporeOR1manuel12/31/16 8:36 PM12/31/16 9:08 PMCycle Complete19163041.9.2A
HospitalA
 
 8477231/1/17 12:19 AMBacteriaOR3cindy12/31/16 11:04 PM12/31/16 11:19 PMCycle Complete9043861.9.2AHospitalA 
              
1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @Cyprix,

 

If I understand you correctly, you should be able to firstly use the formula below to add a calculate column to get the day of the week.

Day of Week = FORMAT(HospitalB[EndTime],"dddd")

c1.PNG

 

Then use the formula below to create a new measure to calculate how many times each room was completed.

Count Of Completed = CALCULATE(COUNTA(HospitalB[StopReason]),HospitalB[StopReason]="Cycle Complete")

m1.PNG

 

And then you can show the Room column with the Day of Week column and the measure [Count Of Completed] on the Table visual. Smiley Happy

r1.PNG

 

Regards

View solution in original post

3 REPLIES 3
v-ljerr-msft
Employee
Employee

Hi @Cyprix,

 

If I understand you correctly, you should be able to firstly use the formula below to add a calculate column to get the day of the week.

Day of Week = FORMAT(HospitalB[EndTime],"dddd")

c1.PNG

 

Then use the formula below to create a new measure to calculate how many times each room was completed.

Count Of Completed = CALCULATE(COUNTA(HospitalB[StopReason]),HospitalB[StopReason]="Cycle Complete")

m1.PNG

 

And then you can show the Room column with the Day of Week column and the measure [Count Of Completed] on the Table visual. Smiley Happy

r1.PNG

 

Regards

Yes thank you that helped alot but now I am trying to have my tables show blanks for days that no rooms were not logged.Test.PNG

 The table on the left shows data where no rooms were logged on Monday, and I feel the data can be easily misunderstood if it does not show the blank Monday column on the table. The goal is to have table 1 one look like table 2 wether or not a day was skipped. 

 

Thank you in advance,

 

Alex

Hi @Cyprix,

 

A few more steps are needed to achieve that. Smiley Happy

 

1. Use the formula below to create a new table which contains a column of Day of Week.

WeekTable = 
DATATABLE (
    "Week Day", STRING,
    "Index", INTEGER,
    {
        { "Sunday", 1 },
        { "Monday", 2 },
        { "Tuesday", 3 },
        { "Wednesday", 4 },
        { "Thursday", 5 },
        { "Friday", 6 },
        { "Saturday", 7 }
    }
)

t1.PNG

 

2. Sort Day of Week column by Index column.

 

sort2.PNG

 

3. Create a relationship between the WeekTable and your original table with the Day of Week column.

relation1.PNG

 

4. Then show the Day of Week column from the WeekTable(instead of the original table) on the Matrix, and right click on the column and select "Show items with no data".

r1.PNG

 

 

Regards

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.

Top Solution Authors
Top Kudoed Authors