time
20 Topicssorting on a joined table custom sort
Hi. I created a custom sort table and joined it to my values table so that I could sort time, on an X axis, alphabetically. For some reason, it starts out sequentially but stops after 8am. This should be relatively simply as I have a table with a custom sort, it's joined on a 1:M, but for some reason, it's not applying it. I have the custom sort field in the 'tooltips' field.Solved1.4KViews0likes7CommentsRANKX Over 3 Fields. ID, DATE, TIME & Direction
Hi All, First post, hoping you can help me š I'm writing some DAX code (Using the DAX query window to test) to create a table that will give me a rank over my ID, Date, Time and direction fields Sample Data... Sheet1[Id] [Date] [Time] Sheet1[Direction] Sheet1[RANK] [NEW RANK] 1 01/05/2024 07:45:00 In 1 1 1 01/05/2024 09:45:00 In 2 2 1 01/05/2024 10:46:00 Out 1 1 1 01/05/2024 11:02:00 Out 2 2 1 01/05/2024 12:02:00 Out 3 3 1 01/05/2024 13:00:00 In 1 3 1 01/05/2024 13:00:00 Out 1 4 1 01/05/2024 13:02:00 In 1 4 1 01/05/2024 15:05:00 Out 1 5 1 01/05/2024 18:33:00 In 1 5 2 01/05/2024 10:25:00 Out 1 1 2 01/05/2024 13:25:00 Out 2 2 2 01/05/2024 15:33:00 In 1 1 2 01/05/2024 16:00:00 In 2 2 2 01/05/2024 16:55:00 In 3 3 2 01/05/2024 17:21:00 Out 1 3 2 01/05/2024 18:00:00 Out 2 4 2 01/05/2024 19:33:00 Out 3 5 2 01/05/2024 19:34:00 In 1 4 2 01/05/2024 20:00:00 In 2 5 Below is my code EVALUATE SELECTCOLUMNS( Sheet1, Sheet1[Id], "Date",FORMAT(Sheet1[Date],"dd/mm/yyyy"), "Time",FORMAT(Sheet1[Time],"hh:mm:ss"), Sheet1[Direction], Sheet1[RANK], "NEW RANK", RANKX( FILTER( Sheet1, Sheet1[Id] = EARLIER(Sheet1[Id]) && Sheet1[Date] = EARLIER(Sheet1[Date]) && Sheet1[Direction] = EARLIER(Sheet1[Direction]) ), Sheet1[Time], , ASC, DENSE )) I'm getting the "NEW RANK" field and I want the 'Sheet1'[Rank] field (I just wrote this out in Excel) The first 2 groups of "In" and "Out" work well but row 6 goes to 3 and does not reset back to 1 as desired Feels like Iām close , any help would be greatly appreciated š Many thanks!Solved786Views0likes2CommentsDAX Measure Question
Hi, First time poster, relatively new (but not brand new) to PowerBI. I am create a marketing dashboard for my company, and I am stuck on creating a measure that shows a count of new opportunities by region in the past 30 days. I have got the time filter right, and I didn't think I would need to put anything about the regions in the measure, but the results are telling me otherwise. So here are some details so that wiser minds can help me. The tables are Calendar (date : creation date) CRM Opportunity (organization : Org ID) CRM Region The Measure is: New Opps Last 30 Days = CALCULATE(COUNT('CRM Opportunity'[Opportunity Code]),FILTER(ALL('CRM Opportunity'),'CRM Opportunity'[Creation Date] >TODAY()-30 && 'CRM Opportunity'[Creation Date]<= TODAY())) When I put it in a table, as shown below, it's summing all the new opportunities in the last 30 days correctly, but not discerning any difference between the regions. In the details table, below that, you can see the break between Canada and Central. There are 21 opportunities for Canada, 20 for Central, etc. I assumed the table and the measure would work together, but clearly I'm wrong. Can anyone tell me what I'm doing wrong, and how to do this correctly? I'd really appreciate it! Thanks, KirstinSolved512Views0likes1CommentMeasure to Filter out Values Based on Current Time
I'm working on an operational dashboard to show production by location. When the executive looks at the dashboard in the early morning before store hours, I want them to see yesterday's production numbers. After 9 am, I want them to start seeing today's production. How do I filter based on the current time? Here's the if statement I'm testing: // IF the current hour is before 9 am IF(TIME(HOUR(UTCNOW()), MINUTE(UTCNOW()), SECOND(UTCNOW())) < TIME(9,00,00), // THEN show yesterday's numbers CALCULATE(SUMX(FactTagProduction, [ValueStocked]), DATEADD(FactTagProduction[DateID], -1, Day) ), // ELSE show today's numbers CALCULATE(SUMX(FactTagProduction, [ValueStocked]), FactTagProduction[DateID] = TODAY() ) )Solved1.4KViews0likes4CommentsAutomatically determine which fiscal months are YTD across years
Below is a sample from my Date table. Our fiscal year runs April - March. I have 4 years worth of data. My data is in the "Sales Month" format, I do not receive actual days, just the month in that format. When I loaded my August data a few days ago, my YTD for this year and prior years would be April - August. When I did this in Excel I would add a column to my date table and each month I would add a Y to the new month in all 4 years that designated YTD and I would filter on it. Is there a way to do something like this, but automatically based on the last sales month loaded? TYIA.400Views0likes1CommentConsecutive Minutes run and missing days in between
Hi, I'm trying to create the 'CONSECUTIVE MINUTES' column and the 'MISSING DAYS STATUS' CONSECUTIVE MINUTES IS IF THE STATUS REMAINS THE SAME WITHIN THE DAY FOR THE SAME ID, and counting the minutes from the last status if consecutive. 'MISSING DAYS STATUS' should be days missing in between any of the status changes. I'm having a difficulty with this piece and tried using similar approaches. ID DATTIME TIME STATUS CONSECUTIVE MINUTES MISSING DAYS STATUS XYZ 3/13/2023 2:00PM COMPLETED XYZ 3/13/2023 3:30PM COMPLETED 90 BYZ 3/14/2023 9:00AM INCOMPLETE BYZ 3/14/2023 11:00AM INCOMPLETE 120 XYZ 3/15/2023 5:00PM INCOMPLETE 2 BYZ 3/17/2023 9:00AM COMPLETED 31KViews0likes4CommentsChanging a date formula with a visual filter
Hi, I want to change this formular by a visual filter: Difference Days to Overdue = IF([Progress] = "Finished", BLANK(),DATEDIFF([Due Date (DD/MM/YYYY)], MIN('Calendar'[Date]) ,DAY)) The one marked in red should be a selectable value from the created table Calendar. I want a visual filter where you can select a certain range and then the minimum of this range is selected. When I currently insert a visual filter of Calendar[Date] into my report page, the formula does not filter with. Thanks in Advantage.Solved691Views0likes2CommentsConvert text value to long time
Hello comunity. I have duration value in sec(integer), I use DAX to convert it to time Movement Time = VAR Duration ='Summary table'[Duration(sec)] VAR Hours =INT ( Duration / 3600) VAR Minutes =INT ( MOD( Duration - ( Hours * 3600 ),3600 ) / 60) VAR Seconds =ROUNDUP(MOD ( MOD( Duration - ( Hours * 3600 ),3600 ), 60 ),0) VAR H =IF ( LEN ( Hours ) = 1, CONCATENATE ( "0", Hours ),Hours) VAR M =IF (LEN ( Minutes ) = 1, CONCATENATE ( "0", Minutes ),Minutes) VAR S =IF (LEN ( Seconds ) = 1, CONCATENATE ( "0", Seconds ),Seconds) RETURN CONCATENATE (H,CONCATENATE ( ":", CONCATENATE ( M, CONCATENATE ( ":", S ) ) )) Then I try appy time format for this column and got error So this perfectly works untill my time value less or equall to 23:59:59. question - how can I convert duration to time like hhh:nn:mm and apply time format as wellSolved1KViews0likes3CommentsCount staff that move between roles
Hi All, I am new to Power BI and I am struggling to create a measure that counts staff of different categories on a particular date. My model is as below: The 'Events' table records include a staff number, post ID, and a date on which that staff member attained that post ID. Each post ID corresponds to a fleet, rank, and status in the 'Post' table. Staff Number Post ID Date 123456 2 09/05/2022 234567 15 14/05/2022 I am trying to count the current number of pilots for each fleet, rank & status, but I cannot work out how to count only the most recent post ID for each pilot. I know that a row-specific context is required to check each staff number, but I am unsure how to confirm a record includes the most recent date in the table for that specific staff number (ie their current post). Here is my DAX code so far: Active Staff = CALCULATE ( COUNTROWS ( Events ), FILTER ( ALLSELECTED ( Events ), Events[Staff Number] = Events[Staff Number] && Events[Date] = MAX ( Events[Date] ) ) ) And here is the output with my actual dataset. There are 238 rows in my 'Events' table whilst there are 202 discrete staff numbers, so I feel like I'm getting close, I just need help to fix the context of the date & staff number comparison. Any advice or guidance would be greatly appreciated! Kind regards, JamesSolved1.9KViews0likes7CommentsChange Start of the day
Hello all, I have found a calendar with severals columns I need as indexDay, indexWeek... It works for a part of my sources, but I have some sources how don't start their day at 00:00 but at 05:00 AM. I have tried several things to change my start of the day but nothing change. I need that my date (Day) start at 05:00 AM and end at 4:59 AM of the Day+1 and in concecuency my others periods follow this start and end. Ex : last IsoWeek have started on 04/11/22 at 5:00 AM and it end was on 04/18/22 at 4:59 AM Could you help me please? Date sort = GENERATE ( CALENDAR( DATE( YEAR( TODAY() ) - 3, MONTH( TODAY() ), DAY( TODAY()) ), TODAY()), VAR startOfWeek = 2 // Where 1 is Sunday and 7 is Saturday, thus a 3 would be Tuesday VAR currentDay = [Date] VAR days = DAY( currentDay ) VAR weeks = WEEKNUM(( currentDay ),21) VAR months = MONTH ( currentDay ) VAR years = YEAR ( currentDay ) VAR nowYear = YEAR( TODAY() ) VAR nowMonth = MONTH( TODAY() ) VAR dayIndex = DATEDIFF( currentDay, TODAY(), DAY) * -1 VAR todayNum = WEEKDAY( TODAY(),2 ) VAR weekIndex = ROUNDDOWN((dayIndex + todayNum - startOfWeek - 5)/7,0) //VAR weekinMonthIndex = (1 + WEEKNUM( currentDay ) - WEEKNUM( STARTOFMONTH (TODAY()),21)) RETURN ROW ( "day", days, "month", FORMAT(months,"0#"), "week", FORMAT(weeks,"0#"), "year", years, "day index", dayIndex, "week index", weekIndex, "month index", INT( (years - nowYear ) * 12 + months - nowMonth ), "year index", INT( years - nowYear ) //"WeekinMonthIndex", weekinMonthIndex ) )Solved2.1KViews0likes4Comments