Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have a question since i found no answer to it. I have tried generate , dateadd but still can't find the answer.
I would like to make a measure for every hour range from min datetime and max datetime from a column in a MyTable.[Date]
How can i write this code?
Thanks a lot
Solved! Go to Solution.
Hi , @dannytan1112
According to your description, you want to "every hour range from min datetime and max datetime".And bu another, if you create a measure , it can not return a list , measure in Power Bi can only return a value.
Here are the steps you can refer to :
(1)This is my test data:
(2)We can click "New Table" and enter:
Table 2 = GENERATESERIES(
MIN('My Table'[Column1]),
MAX('My Table'[Column1]),
1/24)
Then we can get this table you want to :
For more information, you can refer to :
Creating a List of Numbers or Dates in Power BI using GenerateSeries Function in DAX - RADACAD
CALENDAR function (DAX) - DAX | Microsoft Learn
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , @dannytan1112
According to your description, you want to "every hour range from min datetime and max datetime".And bu another, if you create a measure , it can not return a list , measure in Power Bi can only return a value.
Here are the steps you can refer to :
(1)This is my test data:
(2)We can click "New Table" and enter:
Table 2 = GENERATESERIES(
MIN('My Table'[Column1]),
MAX('My Table'[Column1]),
1/24)
Then we can get this table you want to :
For more information, you can refer to :
Creating a List of Numbers or Dates in Power BI using GenerateSeries Function in DAX - RADACAD
CALENDAR function (DAX) - DAX | Microsoft Learn
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
It works for me now. Really thanks
Hi Mahesh,
Thanks for the reply. But it seems like it doesn't work for me.
This is the table I received
And this is it while I put it on the table
So the idea is that I have a column let say it starts with 21st dec 2022 and my last data is 28th dec 2022, in some of my data, let say 24th dec from 1 pm to 4 pm has no data (therefore no row of datetime in that column. But i would like to show it in my graphic as no data. Therefore i need to have a measure that will generate
21/12/2022 12:00:00 AM //My first datetime in my dataset
21/12/2022 01:00:00 AM
21/12/2022 02:00:00 AM
:
:
:
24/12/2022 12:00:00 PM
24/12/2022 01:00:00 PM
:
:
Until Max Date (Last hour in my dataset)
24/12/2022 02:00:00 PM
Really thanks for your help sir
Here is my code
Measure =
Var MaxDateTime = Max('MyTable'[DateTime])
Var MinDateTime = Min('MyTable'[DateTime])
RETURN
SELECTCOLUMNS( //I did try with addcolumn as well, dont work
CALENDAR(MinDateTime,MaxDateTime),
"Hourly Interval", [Date] + TIME(1,0,0)
)
Thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
75 | |
52 | |
46 | |
15 | |
12 |