Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
h4tt3n
Helper V
Helper V

Problems with graph showing timestamped data, can't use working calendar as x axis.

Hello  everyone,

 

I am working professionally with processing and visualizing timestamped sensor data, like temperature and power. For that purpose, I have built a DAX calendar table with date and time for use as the x axis in graphs and for a time slicer.

 

However, when consuming data from a certain API, I simply can't make PBI show data or do time slicing using my trusted method. I have spent hours and hours trying to pinpoint the problem, but I'm at my wits end and hope for some useful feedback from you people.

 

When visualizing data using the data table timestamps as x axis, there is no problem:

image.png

 

 

But when I replace the timestamp column with my own datetime column, nothing is shown:

2020-11-13 13_45_35-CyberSnap ICB Test 03 - Power BI Desktop.png

 

 

 

Here is the DAX code for my calendar:

 

 

 

CalendarDate = //

ADDCOLUMNS 
(
    //calendarauto(1),
    CALENDAR( min( 'Tagsdata Between'[d] ), max( 'Tagsdata Between'[d] ) ),
    "Year", YEAR ( [Date] ),
    "QuarterOfYear", Quarter ( [Date] ),
    "MonthOfYear", MONTH( [Date] ),
    "WeekOfYear", WEEKNUM( [Date], 1 ),
    "DayOfMonth", DAY( [Date] ),
    "DayOfWeek", WEEKDAY ( [Date] ),
    "DayName",  FORMAT ( [Date], "dddd" ),
    "MonthName",  FORMAT ( [Date], "mmmm" ),
    "IsWorkingDay", NOT WEEKDAY( [Date] ) IN { 1,7 }
)
CalendarTime = //

VAR HourTable    = SELECTCOLUMNS( GENERATESERIES( 0, 23 ), "Hour",   [Value] )
VAR MinuteTable  = SELECTCOLUMNS( GENERATESERIES( 0, 59 ), "Minute", [Value] )
VAR SecondsTable = SELECTCOLUMNS( GENERATESERIES( 0, 59 ), "Second", [Value] )

RETURN
 
ADDCOLUMNS
(
    //CROSSJOIN( HourTable, MinuteTable, SecondsTable ),
    CROSSJOIN( HourTable, MinuteTable ),

    //"Time", TIME( [Hour], [Minute], [Second] )
    "Time", TIME( [Hour], [Minute], 0 )
)
CalendarDateTime = //

ADDCOLUMNS
( 
    CROSSJOIN( 'CalendarDate' , 'CalendarTime' ),
    "DateTime", 'CalendarDate'[Date] + 'CalendarTime'[Time]
)

 

 

 

 

Screenshot of CalendarDateTime:

 

image.png

 

Screenshot of relations:

 

2020-11-13 13_39_42-CyberSnap ICB Test 03 - Power BI Desktop.png

 

 

Here is the raw output from the API that I'm having trouble with ("d" is timestamp and "v" is sensor value):

{"d":"2020-08-25T21:27:50.298Z","v":0.002}

 

I have tried changing the formatting, and both included and excluded seconds in my calendar table. 

 

In the M Power Query all relevant columns are casted to type datetime.

 

What am I overlooking?

 

Cheers & have a nice weekend,

Mike

 

1 ACCEPTED SOLUTION
v-janeyg-msft
Community Support
Community Support

Hi, @h4tt3n 

 

It’s my pleasure to answer for you.

According to your description,I think the calendar table may be no problem.But,your data has millisecond, Although they are  datetime types, they can't match,so it doesn't show up.You can try to extract the year, month, day,hour,minute and second from the original data in PQ to reconstruct a datetime,then create relationships.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
RikMuilwijk
New Member

Thanks alot for sharing your DAX code and showing the relationships between your sensor data and the created calendar. This thread helped me big time plotting sensor data over time with a nice slicer for date

v-janeyg-msft
Community Support
Community Support

Hi, @h4tt3n 

 

It’s my pleasure to answer for you.

According to your description,I think the calendar table may be no problem.But,your data has millisecond, Although they are  datetime types, they can't match,so it doesn't show up.You can try to extract the year, month, day,hour,minute and second from the original data in PQ to reconstruct a datetime,then create relationships.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@h4tt3n , does your DateTime column has a hierarchy? else create an Hierarchy

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors