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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
shris1993
Frequent Visitor

Need help aggregating a provider schedule data

Hi Guys,

 

I have a dataset of providers appointment schedule which looks something like the below table

shris1993_0-1709405567275.png

 


I have the provider name column , then start date time and end date time for the appointment holds.
I have extracted the time from start date and end date column in two other columns which are start time and end time.
Then I have the reason type.

 

For my analytical reporting , my team wants to see the data in the below form, 
the table will have a date column (which i will get it from a date dimension table)
the date column will include dates from 2022 start till now and going forward , for each date they want to see how much time was blocked for each provider in a day.

The problem i am facing is in my fact table , I have start date and end date for the appointment , so if the same hold(appointment) repeats for 1 year starting (for example someone blocked 10 am to 11 am every day of the working days, starting from 01-01-2023 and it ends on 05-05-2024) from 2023 and going till 2024 , how do i connect that to the my date dimension table.

Can you please help me with the query.
I want the appointment in the following format.

DateProvider nameaapointment hourtype
1/1/2024gongalez3out of office
1/2/2024gongalez3out of office
1/3/2024gongalez3out of office
1/4/2024gongalez3out of office
1/5/2024gongalez2initial councelling
1/6/2024gongalez2initial councelling
1/7/2024gongalez2initial councelling
1/8/2024gongalez2initial councelling
1/9/2024gongalez2initial councelling
2 REPLIES 2
shris1993
Frequent Visitor

Hi @dufoq3 , Sorry , I know it's a bit complicated.
I will try to explain it clearly.

I have a dataset that i have transformed in the power quesry and it looks like below.



It has a start date column , an end date column , and the days difference between them.

Screenshot 2024-03-02 144123.png

 

Now as you can see here in the table the days difference between the start date and end date can range from 100 days to 365 days or more. It just mean that this appointment is on a repeat basis for every working day for a year or 3 month or 6 month.(depends on the range difference between start date & end date).

lets take one line item from my fact table with starting date 02-02-2023 and end date 03-03-2024. so the days difference between them is a year. 
Now , between these date difference from end date to start date , whatever dates comes in between , they should count this appointment for those dates. (This is the step i am stuck at, how to connect this days difference range to a date dimesnion table so that whatever dates comes in between of those range , will count this appointmnet as 1)

 

I have created a date  dimension table in my model which ranges from the earliest date of start date column till the latest date of end date column.
I want to use it to filter and aggregate my fact table in the below output

Screenshot 2024-03-02 144246.png
Is there any way i can connect or query, so that when i drag and drop my date dimension table in the rows , it will show appointment count on that day by counting the fact table line item.

I hope you understand my question , let me know if you want any more clarification.

dufoq3
Super User
Super User

Hi @shris1993, I'd like to help you, but to be honest I don't know what exactly you need. Could you create sample data and then expectet result based on that sample data plase? Also try to describe it once again please 😉


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors