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
gustavjMC
Frequent Visitor

Time range for time column

Hello!

 

I'm working on a report where i want my graph to be dependent on a start and stop time from another table. 

 

In SQL my code would look something like this:

SELECT [Value]

            ,[logTime]

FROM database

WHERE logTime BETWEEN [startTime] AND [stopTime]

 

My code in dax for creating a calculated column looks like this (or at least, this is what I want to achieve)

Range = FILTER('Temp'[logTime], 'Temp'[logTime] > 'Wash'[startTime] AND 'Temp'[logTime] < 'Wash'[logTime])
 
Is there any possibility of doing this kind of calculated column where the start and stop time of the column is based on another table?
 
1 ACCEPTED SOLUTION

Thanks for replying!

With this COUNTX function, it only counts the rows, but i want the actual rows in a table to be returned 🙂

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@gustavjMC ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
amitchandak
Super User
Super User

@gustavjMC , This should have worked as a column in 'Temp' table

 

Range = Countx(FILTER('Temp', 'Temp'[logTime] > 'Wash'[startTime] AND 'Temp'[logTime] < 'Wash'[logTime]), 'Temp'[logTime])

 

refer video for example -https://www.youtube.com/watch?v=czNHt7UXIe8

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for replying!

With this COUNTX function, it only counts the rows, but i want the actual rows in a table to be returned 🙂

if by ' but i want the actual rows in a table to be returned' you actually mean that you want the total count of rows from the table that is returned after applying the FILTER(), then, if I am not mistaken, you need to effect a filter transition programmatically, and the only way to do this in DAX is not the FILTER() function, but CALCULATE and CALCULATETABLE.

 

Rather than copy/paste a whole chapter, read chapter 5 from the book: 'The Definitive Guide to DAX,' 2nd edition,  by Marco Russo and Alberto Ferrari.  It's all explained there better than I could.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.