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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
helen_p
Frequent Visitor

2 columns from seperate tables being filtered in DAX expression

Dear Power BI community

 

What do I want to achieve?

I am looking for some assistance to help create a DAX expression so I can filter across 2 different tables

1. 'Dim date table'[DaysFromToday]

2. 'Dim time table'[HourOfDay]

 

So I can show what?

I want to get the average number of discharges at the same point in time (Current hour) over the last 4 weeks

For example.  On average there were 15 discharges on a Friday for the last 4 weeks between 12pm-1pm

 

How is my data structured

My data is structured so that I can get a count of discharges for every day and fo every hour of day

 

SumOfDischargeCountDaysFromTodayHourOfDay
6-280
6-283
5-285
6-286
8-287
5-288
6-289
18-2810
14-2811
13-2812
17-2813
20-2814
24-2815
27-2816
31-2817
31-2818
20-2819
26-2820
11-2821
10-2822
7-2823

 

So far my DAX looks like this:

 

Test CROSSJOIN =
              CALCULATE (
            [SumOfDischargeCount],
            FILTER (
                CROSSJOIN ( ALL ( 'Dim date table'[DaysFromToday] ), ALL ( 'Dim time table'[HourOfDay] ) ),
            'Dim date table'[DaysFromToday]  = {-7} || 'Dim date table'[DaysFromToday] = {-14} || 'Dim date table'[DaysFromToday] = {-21} || 'Dim date table'[DaysFromToday] = {-28} || 'Dim time table'[HourOfDay] <= [Current hour]
            )
        )
 
What do I also need to consider?
 
I need to also consider making sure I get the average
 
 
Can anyone help assist me please
 
 
1 REPLY 1
helen_p
Frequent Visitor

Think I have solved my own issue

 

Test 2 =
CALCULATE ([SumOfDischargeCount]
,
'Dim date table'[DaysFromToday] = {-7} || 'Dim date table'[DaysFromToday] = {-14} || 'Dim date table'[DaysFromToday] = {-21} || 'Dim date table'[DaysFromToday] = {-28}, FILTER('Dim time table', 'Dim time table'[HourOfDay] = [Current hour] ))/4

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.