min
20 TopicsRolling Date Identifiers
I support a team monitoring weekly captured data from a 5 week window. Each row of my set has a specific date - thousands of rows of data fitting into 5 weeks, and my report needs to dynamically compare each week's data with the others. I'm working to prep DAX to assign number 1-5 to each of the weeks as the project rolls on. So currently: Dec 22 = 1, Dec 29 = 2, Jan 5 =3, Jan 12 = 4, Jan 19 = 5. Next week: Dec 29 = 1, Jan 5 = 2, Jan 12 = 3, Jan 19 = 4, Jan 26 = 5 and so on.. First time in the forums so please let me know if I need to provide additional context.Solved1.2KViews2likes6CommentsCalendar Table returning error: The expression specified in the query is not a valid expression
I am racking my brain. I am building a PBi dash from a SharePoint list. Before, the list had only a few lines of test data, so I had no problem creating the calendar table. However, I have a second data source, and I needed to build a calendar based on both sources' tables to make a splicer to filter visuals by date. At first, I thought the issue was that I had 2 data sources, so I combined them into 1 data source and simplified my DAX Date = CALENDAR( MIN('Deskside QA'[DateofQA]), MAX('Deskside QA'[DateofQA]) ) But after that, I get the error "The start date in Calendar function can not be later than the end date." So I added variables to lock down the functions Date = VAR MinDate = CALCULATE(MIN('Deskside QA'[DateofQA])) VAR MaxDate = CALCULATE(MAX('Deskside QA'[DateofQA])) RETURN IF( ISBLANK(MinDate) || ISBLANK(MaxDate) || MinDate > MaxDate, CALENDAR(TODAY(), TODAY()), // Fallback to a single day calendar if dates are invalid CALENDAR(MinDate, MaxDate) ) But then I get the error "The expression specified in the query is not a valid expression" I have been running in circles and throwing in curly brackets but nothing seems to give me a solution.Solved3.5KViews1like10CommentsFlag to mark two lowest values from Table. Grouped by other columns
Hello, I am using table in direct query mode as source. Table shows active users already grouped per Month, country, User_Tier, User_Group for last 12 weeks. Example below. Example table is smaller, but by default each month based on Month_Key has 12 Reported_weeks. Combinations of possible User_Tier, User_Group differs - so it may be 1 row per Reported_week or 5 tows per reported_week. Country Month_Key Reported_Week USER_TIER User_Group Weekly_Users_Count PT 20240901 202428 A H 20 PT 20240901 202428 B J 10 PT 20240901 202429 A H 30 PT 20240901 202429 C H 20 PT 20240901 202430 B J 10 PT 20240901 202430 C H 30 FR 20240901 202428 B G 50 FR 20240901 202428 B T 40 FR 20240901 202429 A G 100 FR 20240901 202429 A G 55 FR 20240901 202430 A G 66 Currently there is a measure that caluclates a Weekly number of active users by: # Weekly Active Users = Calculate(Divide(Sum(Table[Weekly_User_Count]),12)) Is there a possibility at DAX level to change the calculation to take only 10 weeks with best values for each month and country? So basicly Flag two worst Reported_Week (sum of all combination of User_Tier, User Group). I tried do it two ways and failed: Idea #1 - FAILED - Create Dax measure to detect lowest values. I used "MIN" Idea #2 - FAILED - Create a calculated Column to mark rows with lowest values. Again failed, aiming to use "EARLIER" Thank you gor helpSolved588Views0likes2CommentsMIN filter not returning expected result
Hi I would like to return the minimum value based on the selection criteria used. Using the min function does not return the expected result. Please see below examples. Maybe I am overseeing something. Great if anyone can help. In below measure I calculate the minyear (minimum year selected on page filter is 2021) and use it in the filter. This does not return the desired outcome as it also returns values in 2022. In below example I do the same, however, the filter is not based on a minimum but on a year defined, in this case 2021. This is the desired outcome as it is not showing 2022 values. Below the filter used on the page.Solved1.2KViews0likes2Commentsget MIN, MAX DATE then count duration in hour
hi all; i have data set, https://docs.google.com/spreadsheets/d/159xOcmrKj95YXYOayHmGi9A_K_8ZHIMq/edit?usp=sharing&ouid=100079262241875009342&rtpof=true&sd=true the point is; i already get MIN DATE, and MAX DATE ( with Measurement); but then how to get duration(hour) from that ? i tried using DATEDIFF formula but the result is wrong . First Started = CALCULATE ( MIN ( 'Data'[DateStarted] ), ALLEXCEPT ( 'Data', Data[DateCreate], Data[worker] ) ) Last Finished = CALCULATE ( MAX ( 'Data'[DateFinished ), ALLEXCEPT ( 'Data', Data[DateCreate], Data[worker] ) ) duration(hour)= datediff([Last Finished] , [First Started],HOUR) thank you for your help; AzuraSolved1.5KViews0likes4CommentsNight shift (logic, calculation)
Hi everybody, I'm looking for a solution, but I can't find it. I would like to know the time worked. Info: - People work in the morning, afternoon and night. Overtime is also possible. - Thousands of posts are made in a day, that's thousands of time data. So there is not only a beginning and an end. - Morning shift: 06-14 (can be overtime: 02-14, 06-18) - Afternoon shift: 14-22 (can be overtime: 10-22, 14-02) - Night shift: 22-06 (can be overtime: 18-06, 22-10) MIN - MAX works in the morning and in the afternoon, because the time data comes one after the other. It does not work at night because it is separate, e.g.: 0:00 (start) -> (end) 6:00 + 22:00 (start) -> (end) 0:00. This is a MIN - MAX 24h. time worked = VAR balans = CALCULATE ( MAX (EVENTHistory[hour]), FILTER ( ALLSELECTED ( 'EVENTHistory' ), EARLIER (EVENTHistory[worker]) = 'EVENTHistory'[worker] ) ) - CALCULATE ( MIN (EVENTHistory[hour]), FILTER ( ALLSELECTED ( 'EVENTHistory' ), EARLIER (EVENTHistory[worker]) = 'EVENTHistory'[worker] ) ) RETURN FORMAT ( INT ( balans * 24 ), "00" ) & ":" & FORMAT ( INT ( MINUTE ( balans ) ), "00" ) & ":" & FORMAT ( INT ( SECOND ( balans ) ), "00" ) Thank you in advance for your help.1KViews0likes2CommentsHelp! How to sum up minimums?
Hey guys, I'm trying to sum up the minimums I got from this formula: min(balanced order qty, physically available). I tried sumx(table, min(balanced order qty, physically available)) but didn't work. Highlight above is what I expect to get. Thank you so much!!!528Views0likes1CommentCount of Projects from Min Stage to Max Stage Display in Matrix Visual
Hi Everyone, I am trying to create matrix visual based on my sample data for project transition, based on date of status change selection my projects from stage and to stage should be changed and always I should showcase latest stage for project Sample Input: Expected Output When I Select Date From 11-16-2021 to 5-25-2022 or after When I Select Date From 11-16-2021 to 5-24-2022 Always project status transition is from Latest From Status to Latests To Status. Thanks Advance for your help!Solved1.2KViews0likes6CommentsFinding earliest date given a value in another column
Hello, I am having trouble creating a measure that takes the earliest date based on a value in another column. To break it down in simpler terms, let's call the referenced column "Status" and the two possible values are "Yes" or "No", and in this case we are filtering for "Yes". The date column will be called "date". So far, I've been successful with writing a measure that takes the earliest date column using the MIN function: Measure1 = MIN('Table Name'[Date]) I've tried incorporating the Status = "Yes" component of the measure as well with no luck. Here are some instances I've tried: Measure2 = MIN(FILTER('Table Name', 'Table Name'[Status] = "Yes")) Measure3 = MIN('Table Name'[Date], FILTER 'Table Name', 'Table Name'[Status] = "Yes") Measure4 = FILTER('Table Name', 'Table Name'[Status] = "Yes", MIN('Table Name'[Date])) Perhaps the FILTER function isn't the way to go here. Any feedback is appreciated.Solved14KViews0likes3Commentscalculate not respecting its own filter
Hoping I can get some help here. I have a measure using another measure as a filter value to try to find the earliest date for which a column equals the filter value. I'm getting strange behaviour from the peakdate measure, however. I have a table: TABLE, with columns DATECOL and INDICATOR. The date range in this table is not continuous, but spans more than a year,and ends on the current day (and there are data for that current day). I have a measure, PEAK, that finds the maximum value of INDICATOR that falls within a date range. PEAK = calculate(maxx('TABLE', 'TABLE'[INDICATOR]),'TABLE'[DATECOL]>=date(2021,12,01)&&'TABLE'[DATECOL]<=date(2022,03,01)) This measure seems to work fine - finds the peak value in that date range, and I can confirm that by visually inspecting values in the table. I have ANOTHER measure, DATEOFPEAK, that I want to return the earliest date in DATECOL which the PEAK is observed (in this case, it occurs on multiple days). DATEOFPEAK = calculate(min('TABLE'[DATECOL]),filter(all('TABLE'),'TABLE'[INDICATOR]=[PEAK]&&'TABLE'[DATECOL]>=date(2021,12,01)&&'TABLE'[DATECOL]<=date(2022,03,01)) This will not work, it returns the minimum date specified by the filter (2021,12,01) rather than the minimum date at which the PEAK value is observed in the INDICATOR column. I have ensured that the variables are formatted in the same way. In the original table (which is a calculated table, although I'm having the same problem whether my PEAK measure is based on a preexisting column, a calculated column, or a column in a calculated table), INDICATOR is rounded to 0 (in the actual column calculation in the summarize DAX command). I've tried swapping firstdate for min and I've tried restructuring as a MINX, and everything just returns the minimum date value specified in the PEAK measure but it's ignoring the part of the filter that directs it to filter INDICATOR down to only values that match PEAK. Please, what am I missing?Solved846Views0likes2Comments