Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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)
Solved! Go to 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 🙂
@gustavjMC ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
@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
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.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
15 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
22 | |
11 | |
10 | |
10 | |
8 |