in
6 TopicsAverage Days Between Inspections
Hi, I am trying to get the average days between inspection dates. Below is a breakdown of current dates by project (with blue and green dots being 2 different projects). Below is my attempted DAX for getting the days between inspections, with an average calculation for averages later on: DaysBetweenInspectionsALL = VAR CurrentProject = SELECTEDVALUE(Project[ProjectName]) VAR CurrentDate = SELECTEDVALUE('Date of Inspection'[date]) VAR LastInspectionDate = CALCULATE( MAX('Date'[Date]), FILTER( ALL(Project), Project[ProjectName] = CurrentProject && SELECTEDVALUE('Date of Inspection'[date]) < CurrentDate)) RETURN IF(LastInspectionDate = BLANK(), BLANK(), CurrentDate - LastInspectionDate) However, this has returned all row values as '27/12/1774', even with whole number formatting. I belive this might be from using an incorrect field in the LastInspectionDate variable. Any help would be appreciated, thank you.Solved4.4KViews0likes22CommentsCheck if value is in a List
Hello everybody! How can I find out if one of the selected values is a string? What I tried out: VAR SelectedKpi = SELECTEDVALUE(KPIs[Value]) return IF(SelectedKpi IN {"SOE"},SUM(...),BLANK()) It works, but I select multiple values, it will only work for one at a time. I would like to be able to check if the string is into that variable. Thanks!Solved32KViews2likes2CommentsHow to count values that appear in two tables
I can't provide actual data but I have two queries/tables I'm trying to compare. Table 1 has a bunch of IDs and services provided to those IDs. These IDs can and do show up multiple times (multiple rows) in Table 1 since services occured on different dates over time. Table 2 contains a list of IDs that are considered "current" and each ID appears only once in this table. I want to calculate a rate of how many current IDs have had services, i.e. the number of current ID's from Table 2 that are present in Table 1 / the total number of current IDs in Table 2. I've tried to create a calculation that filters Table 1 to only the IDs that are also present in Table 2, determine the distinct count of those IDs, and then divide that by the total count of IDs in Table 2 but can't get it to work. Not sure if I should be using a calculated column in one the tables or creating a measure. The ID colums in both tables are setup to have a one to many relationship. Thanks so much!Solved5.3KViews0likes1CommentUsing a date variable in a CALCULATE and COUNTA expression?
I have these 2 DAX expressions : ThisWeek = CALCULATE( COUNTA('MyTable'[Report Date])+0, 'MyTable'[Report Date] IN { DATE(2021, 04, 02) } ) PreviousWeek = CALCULATE( COUNTA('MyTable'[Report Date])+0, 'MyTable'[Report Date] IN { DATE(2021, 03, 26) } ) But I want to alter them so that instead of specifing dates, they use the 2 most recent dates from the Report Dates column. Merging this in, somehow: CalcThisWeek = FORMAT(MAXX('MyTable','MyTable'[Report Date]),"YYYY/mm/dd") Any ideas? Thank you.Solved677Views0likes1CommentUsing IF IN Operator
Hi, I tried the following dax which works using calculate, hwow to simply by using only If statement using IN operator aps=CALCULATE(If(countrows(Pop)>0,"Yes","No"),Pop[city] IN {"Arizona","Arkansas","California","Colorado"}) I need something like below: If(Pop[city] IN {"Arizona","Arkansas","California","Colorado"},"Yes","No") I tried this way but column(Pop[city]) is not showing in DAX editor.Solved3.6KViews0likes4CommentsConvert decimal number to time
So I am importing data from Access and in the power query editor I have tried transform to time, but i get "ERROR". I have 2 times One column has time in format such as 71500 or 151500 and other column has 715 or 1214. In the first case, the time has seconds, which I don't need as all are 00. It does not show 0 in the beginning, so it goes 8 AM being 800 and 3PM being 1500 etc. In the second case, seconds do not exist, and again 0 does not exist. In addition, should I be fixing/labeling data in Access or simply do it in Access? How does it work on the load? I also skip Excel and work directly with the file in PBI. I frequently run out on 32 bit BI, and i can't use 64bit BI since our server with data is 32bit.2.8KViews0likes1Comment