The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a simple table that looks like this...
Time | ID Number | Baseline |
12:00 AM | 001 | 123 |
1:00 AM | 001 | 256 |
11:00 PM | 001 | 269 |
12:00 AM | 002 | 796 |
1:00 AM | 002 | 456 |
The time is for 24 hours. I need to find the sum of Baseline for each ID number only between the 3 hr time window of 1:00PM to 3:00 PM.
I used this measure:
Solved! Go to Solution.
I meant there are no rows between 1:00 PM and 3:00 PM in the sample data you provided in your original post.
Is your time column set to time data type in your model? The measure works as expected on the sample you provided.
Glad to hear it's working for you now! Have a good day.
I meant there are no rows between 1:00 PM and 3:00 PM in the sample data you provided in your original post.
Is your time column set to time data type in your model? The measure works as expected on the sample you provided.
Thank you so much for the suggestion. That's where I went wrong. I built this table by summarizing another table. I changed the time data type for this one but forgot to change the type in the original table. Now that I fixed it, it's working great. Thank you so much for all your help @jdbuchanan71
That is because, in your dataset, there are no rows with a time between 1:00 PM and 3:00 PM
There is data between that time frame. Just to check, I calculated the sum without the time filter expression. And then put time as a filter. Chose between 1 to 3 pm. It shows the right result.
But whenever I put the time filter expression back into the measure, doesn't matter whatever time duration it is. It either shows empty or shows the total sum of 24 hours, not according to the time stated in the filter expression.
@Anonymous
Try it like this.
Time Amount =
CALCULATE (
SUM ( 'Table'[Baseline] ),
'Table'[Time] >= TIME ( 13, 0, 0 ) &&
'Table'[Time] <= TIME ( 15, 0, 0 )
)
User | Count |
---|---|
86 | |
84 | |
36 | |
34 | |
30 |
User | Count |
---|---|
96 | |
75 | |
66 | |
55 | |
52 |