cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Did record happen during day or night?

Hi,

 

I would like to see if my transaction records happened during daylight or during the night - so the time changes for date to date.

 

Table 1 - named 'Counts',
with a [Date] and a [Time] column

 

Table 2 - name 'SunUpDown'

with a [Date], [SunUpTime] and [SunDownTime]

 

Can anyone please help me how I can make a calculated Column in Table 1, for each record to tell me if it happened during the day or night, on that specifical date.

 

2 REPLIES 2
Highlighted
Super User I
Super User I

Re: Did record happen during day or night?

Assuming there's a relationship between the two date fields - I'd have thought it'd just be a case of just doing a two stage if:

 

if([Time]<[SunUpTime],"Night",if([Time]>[SunDownTime],"Night","Day"))

Highlighted
Frequent Visitor

Re: Did record happen during day or night?

I start to suspect that I have made an error in the linking of the tables; as I get the same error as I have gotten during my tests too:

Table 1, with new calculated columnTable 1, with new calculated columnLink between tablesLink between tablesTable 2Table 2

Helpful resources

Announcements
Meet the 2020 Season 2 Power BI Super Users!

Meet the 2020 Season 2 Power BI Super Users!

Find out who's part of the program this season, and welcome the new Super Users.

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Featured Data Story of The Month

Featured Data Story of The Month

All Data Stories Gallery contributions are reviewed for each month. We select a contribution and feature the community member the following month.

Power BI Dev Camp - Developing with .NET Core

Power BI Dev Camp - Developing with .NET Core

Learn how to develop custom web applications for Power BI using .NET Core 3.1 and .NET 5.

Top Solution Authors
Top Kudoed Authors