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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Filter based on data between 2 dates and other matching criteria from another table

Hi

 

I have 2 tables which aren't related. The first holds call data, time of call, where it was routed to etc. The second holds audio information which was manually added to the line at certain points of the day.

 

I am looking to see how many calls came through when certain audio was placed on the line. 

 

I want to add a column in my first table (call data) which shows the audio file name if there was a messge on for that type of call and that type of message was used for a certain purpose at the time of the call. 

 

My Call Data table includes:

Call datetime (date time)

type of call (text)

 

my Audio table includes:

start datetime (date time)

end datetime (date time)

type of call (text)

audio filename (text)

used for (1 or 0)

 

When a call is stored in the first table it has the date time it was made and the type of call,

 

so I need to populate the audio filename into the call data table if:

the call type matches

the call happened between the start and end datetime

there is a "1" in the used for column

 

any help please?

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Create a calculated table first.

temptable =
FILTER (
    CROSSJOIN (
        FILTER ( 'Audio table', 'Audio table'[used for ] = 1 ),
        SELECTCOLUMNS (
            'Call Data table',
            "Call Datetime", 'Call Data table'[Call datetime],
            "Type", 'Call Data table'[Type]
        )
    ),
    [Call datetime] >= [start datetime]
        && [Call datetime] <= [end datetime]
        && [type of call] = [Type]
)

1.PNG

 

In Call Data table, add a calculated column.

FileName =
LOOKUPVALUE (
    temptable[audio filename],
    temptable[Type], 'Call Data table'[Type],
    temptable[Call Datetime], 'Call Data table'[Call datetime]
)

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Create a calculated table first.

temptable =
FILTER (
    CROSSJOIN (
        FILTER ( 'Audio table', 'Audio table'[used for ] = 1 ),
        SELECTCOLUMNS (
            'Call Data table',
            "Call Datetime", 'Call Data table'[Call datetime],
            "Type", 'Call Data table'[Type]
        )
    ),
    [Call datetime] >= [start datetime]
        && [Call datetime] <= [end datetime]
        && [type of call] = [Type]
)

1.PNG

 

In Call Data table, add a calculated column.

FileName =
LOOKUPVALUE (
    temptable[audio filename],
    temptable[Type], 'Call Data table'[Type],
    temptable[Call Datetime], 'Call Data table'[Call datetime]
)

2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-yulgu-msft you my friend are an absolute genuis and I am forever greatful for the help.

 

Worked like a dream, after I amended it slightly with some other filters etc.

 

Keep up the great work and I might be back if I get stuck again.

Greg_Deckler
Community Champion
Community Champion

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

That being said, take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.