Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello PBI community,
I'm looking to count number of loads by hour. The dataset spans over two days and the table visual is calculating the measure incorrectly. What am I doing wrong here? How can I show the visual over two days?
I have some loads that are loaded on 22/06/2021 to be delivered on 23/06/2021. The matrix visual only displays 23/06/2021 data.
When DAX is calculating the measure it is counting by hour only and not on the date. Example:
for 18:00 hours, on 22/06/2021 @ 18:00 hours I have 6 loads and on 23/06/2021 @ 18:00 hours I have 1. However in the visual it is showing as 23/6/2021 @ 18:00 hours as 7 (which is 6 from 22/06 + 1 from 23/06)
I have selected cross filter direction as 'Both' for creating relationship between date and hour table with data table.
Below is the link for power bi file and excel file which shows the difference.
Appreciate your help!
https://www.dropbox.com/sh/l94j7rb9iavm783/AADqJs6dOZU06anbmdfftyiUa?dl=0
Solved! Go to Solution.
Hi @sam0007 ,
First, bi-directional relations are to be used in very rare cases. You don't need them here.
Second, here is the refernce to the correct usage of USERELATIONSHIP function: https://dax.guide/userelationship/
I don't know the final result you want to achieve, but from what you've mentioned, you can try to change your measure in the next way:
Count of loads by hour =
CALCULATE (
COUNT ( f_DataTable[Route ID] ),
USERELATIONSHIP ( f_DataTable[Load Date], d_DateTable[Date] ),
USERELATIONSHIP ( f_DataTable[Load Time], d_HourTable[Time] )
)
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
Hi @sam0007 ,
First, bi-directional relations are to be used in very rare cases. You don't need them here.
Second, here is the refernce to the correct usage of USERELATIONSHIP function: https://dax.guide/userelationship/
I don't know the final result you want to achieve, but from what you've mentioned, you can try to change your measure in the next way:
Count of loads by hour =
CALCULATE (
COUNT ( f_DataTable[Route ID] ),
USERELATIONSHIP ( f_DataTable[Load Date], d_DateTable[Date] ),
USERELATIONSHIP ( f_DataTable[Load Time], d_HourTable[Time] )
)
If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.
Check out my latest demo report in the data story gallery.
Stand with Ukraine!
Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/
Thank you!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
11 |
User | Count |
---|---|
19 | |
14 | |
14 | |
11 | |
9 |