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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Redcol
Regular Visitor

Filtering data based on another table

Hi. Im trying to create a SUM measure 

Calls Offered:=sum(CallsApplicationStats[CallsOffered])

 

now there is a [Time] field in CallsApplicationStats [cas]

and I wanrt to filter this measure where the [TIME] is greater than or equal to and less than

i have done this in SQL Server in a WHERE Clause

 

AND cas.[TIME]>=ca.ApplicationTimeOpen
AND cas.[Time] < ca.ApplicationTimeClose
 
this is to get a count of how many calls we had between the opening and closing hours.
I have not filtered this at source as the buisness are interested in calls that came in Outside these hours as well
 
Any help would be apprciated 🙂
2 REPLIES 2
Anonymous
Not applicable

You have to have two tables that you'll use on slicers or on rows and columns of a matrix. One will store all the ApplicationTimeOpen's and the other one ApplicationTimeClose's. Let's call them AppTimeOpen (with Time column) and AppTimeClose (with Time column as well).

 

Once you have them, then you can create a measure:

 

# Calls Offered =
var __timeOpen = SELECTEDVALUE( AppTimeOpen[Time] )
var __timeClose = SELECTEDVALUE( AppTimeClose[Time] )
var __callsOffered =
	CALCULATE(
		[Calls Offered], -- your measure
		CallsApplicationStats[TIME] >= __timeOpen,
		CallsApplicationStats[TIME] < __timeClose
	)
return
	__callsOffered

When you do this, please do not use the [TIME] column in your report. Hide the column.

 

Best

Darek

Redcol
Regular Visitor

Missed update 

ca.ApplicationTimeOpen & ca.ApplicationTimeClose are in another table.

I have created a calculated column in CallsApplicationStats to bring these both in if that helps 🙂

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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