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
Anonymous
Not applicable

Cross join tables

Hi! 

I need help cross joining two tables. 

 

I have one table that looks like this: 

Table "Openings hours"

 

StoreWeekdayHours open
Store 1Mo8
Store 1Tu7
Store 1We5
Store 1Th10
Store 2Mo4
Store 2Tu3
Store 2We2
Store 2Th1

 

Then I have a Dim Date table:

 

DateWeekday
feb 1 2021Mo
feb 2 2021Tu
feb 3 2021We
feb 4 2021Th

and so on... 

 

I would like to create a new table that gives me the opening hours per date and store: 

 

StoreDateHours open
Store 1feb 1 20218
Store 1feb 2 20217
Store 1feb 3 20215
Store 1feb 4 202110
Store 2feb 1 20214
Store 2feb 2 20213
Store 2feb 3 20212
Store 2feb 4 20211

and so on....

 

I need help with a smart solution! 

 

Cheers! 

Maria

 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

In the Query Editor, you can merge Opening Hours table onto the Dim Date table joining on Weekday and then expand the Store and Hours open columns.

View solution in original post

3 REPLIES 3
Tahreem24
Super User
Super User

@Anonymous , 

Step 1: Join the two tables based on the Weekdays. 

Step 2: Then drag the Stores, date, and hours open from the respective tables on Table visual. 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

If you want to do this in a visual in the report, you can use:

1) 

Sum of hours = SUM('Opening Hours'[Hours open])

2) 

Hours by date =
CALCULATE (
    [Sum of hours],
    TREATAS ( VALUES ( 'Date Table'[Weekday] ), 'Opening Hours'[Weekday] )
)

  and create the visual using the Date field from the Date Table and the Store from the Opening Hours Table:

result.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






AlexisOlson
Super User
Super User

In the Query Editor, you can merge Opening Hours table onto the Dim Date table joining on Weekday and then expand the Store and Hours open columns.

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.