"time"
4 TopicsHow to display current time in your report using a measure, taking summer/winter time into account
Hi everyone! I recently wrote a DAX script for my PowerBI report's landing page to display the current time, but I quickly ran into the issue of taking into account the summer/winter time difference in Central-EU as the powerBI service always takes UTC as the current time. I searched far and wide for anything similar, and only found a time last-refreshed built in Power Query, which wouldn't produce the current time (unless you refresh every minute, hahaha). I thought I'd share it, in case anyone else would want to do the same 🙂 Here's the code, put into a measure: Tijd = var now = NOW() var beginsummertime = DATE(YEAR(NOW()), 3, 31) - WEEKDAY(DATE(YEAR(NOW()), 3, 31), 2) + 3/24 var beginwintertime = DATE(YEAR(NOW()), 10, 31) - WEEKDAY(DATE(YEAR(NOW()), 10, 31), 2) + 3/24 var timezonediff = IF(now > beginsummertime && now < beginwintertime, 2/24, 1/24 ) RETURN now + timezonediff This specific piece of code is made for the Dutch summer and winter timezones (CEST and CET), which change on the last sunday of March and October at 3 AM. Note that it's far from perfect, as it only re-calculates once the page is re-opened or refreshed. But it's the closest I could find to calculating the current time. If you have any questions, comments or tips please let me know!Solved1.7KViews0likes1CommentRetrieve First Date with a measure condition
Hi, This is my first post, so I apologize in advance if I'm not 100% clear. I have a measure that indicates the coverage in months of my inventory. I want to retrieve the first date which that measure is under 3 months. In this scenario it would be 11/03/2024 for all days. The problem is that I'm not working well with the time filters, that influence the PrevEstq measure.Solved749Views0likes4CommentsHow to find inside a string to do time calculation
Hi everyone! I'm working with sports data, calculating the time on court for players and would like to calculate time when a specific string (player name) is inside a column. Due to the data structure, I have the info for the full FiveOnCourt and based on positions but not for a player alone. Here is the example: As you can see, I have "Player7" who played in different positions so I would like to have one only table with the following values for each player (not needed the order because it's only an example with players with more than one position): PLAYER7 - 1 - 00:17:39 (0:05:26 + 0:12:13) - 41 PLAYER13 - 1 - 0:28:40 (0:21:02 + 0:07:38) - 84 PLAYER... PLAYER... So, I guess I have to create a measure to find every string inside the FiveOnCourt but I don't know how I could do it. Could you help me, please? I add the link to the raw data and the pbix file: https://drive.google.com/drive/folders/1BxVWCtoHkcQYnDfOpqmYFpFgXpoEIPOt?usp=drive_link Thank you for your time!647Views1like2CommentsConvert date field to a selected date time zone to calculate adjusted values
Hello, My overall goal is to have users select their desired time zone and see the number of calls answered, based on their time zone selected. My thought process was to convert the call_date time based on the time zone selected from a separate table called 'Time Zones.' This time zone table accounts for Daylight savings and contains all time zone offsets in minutes, depending on where each call_date is between the begin_date and end_date. Here is an example from the Time Zone table: I did this by creating a measure: VAR CurrentDate = MAX('Call Segment'[call_date]) VAR TheZone = IF(ISBLANK(SELECTEDVALUE('Time Zones'[Time Zone Name])), "Greenwich Standard Time", SELECTEDVALUE('Time Zones'[Time Zone Name])) VAR TimeConversion = MAXX( FILTER( 'Time Zones', 'Time Zones'[Time Zone Name] = TheZone && 'Time Zones'[begin_date] <= CurrentDate && 'Time Zones'[end_date] >= CurrentDate ), 'Time Zones'[UTC Offset Minutes] ) RETURN IF( TimeConversion < 0, CurrentDate - TIME(0, ABS(TimeConversion), 0), CurrentDate + TIME(0, TimeConversion, 0) ) The part I am struggling with is counting the number of Call IDs that fall within the newly converted time. I need to show Call Counts (Sum of Call IDs) by this new date, exaclty like below but will dynamically adjust based on that Time Zone: Any help would be greatly appreciated!775Views0likes3Comments