datefilter
3 Topicshow to create a measure to return value for previous nonblank date
im trying to create a measure that returns the closing price for the previous day for a stock. however in some days the stock market is closed so the previous date in this case will be blank. i used the following measure to get the value for last non blank date but its only working in table visual when the date field is added previous day price1 = CALCULATE(SUM('stocks data'[Close]), OFFSET(-1,ALLSELECTED('stocks data'[Date]),ORDERBY('stocks data'[Date],ASC))) when i added the measure to card visual it's returing the sum value of the previous closing price instead of the previous day. in the selected date period , the previous nonblank date is 12-9-2022 and the measure should return142.16 and the day on day change value should be 1.61% any idea on how to fix the measure?955Views0likes4CommentsUSERELATIONSHIP ERROR - breaking results
I am trying to count the number of cases closed and logged in a date range using a DimDate calendar in my slicer. DimDate is a Simple calendar table Date,DateKey,Day,Month,Year I then have a CentralTracker Table which contains all my cases. PersRef,DateLogged,DateClosed,DateLogKey,DateClosedKey I have relationships between DimDate[DateKey] (1) to (*) CentralTracker[DateLogKey] - Active DimDate[DateKey] (1) to (*) CentralTracker[DateClosedKey] - InActive In nearly all instances I filter by Date Logged so it just works. However, I would also like to just count the number of cases closed in the selected range, regardless of the date logged. If I use the following piece of DAX, without filtering, I get the correct count of cases closed. But I can't filter this and get the cases clsoed ignoring the date logged. VAR MinDate = MIN(DimDate[Date]) VAR MaxDate = MAX(DimDate[Date]) VAR Result = CALCULATE( COUNTROWS(Central_Tracker), FILTER(Central_Tracker, Central_Tracker[Date Case Closed] >= MinDate && Central_Tracker[Date Case Closed] <= MaxDate ) ) RETURN Result Using this DAX I get 187 cases, which is correct. When I Introduce USERELATIONSHIP into this to try and get it to filter by the close date rather than the date logged it breaks. VAR MinDate = MIN(DimDate[Date]) VAR MaxDate = MAX(DimDate[Date]) VAR Result = CALCULATE( COUNTROWS(Central_Tracker), USERELATIONSHIP(Central_Tracker[DateClosedKey],DimDate[DateKey]), FILTER(Central_Tracker, Central_Tracker[Date Case Closed] >= MinDate && Central_Tracker[Date Case Closed] <= MaxDate ) ) RETURN Result Using this, again with no filters I get 11. I would expect that without any filters applied that the two values would be the same.Solved1.4KViews0likes2CommentsCreate a Next 12 month filter/Slicer function
Dear Community I'm currently struggling on how to create a date filter that consist of the next year, where starting point should be todays date. I do already have a full functional calendar with all the dates from 2021 to 2031. What i now need, is a way tidentify all the dates that are equal tothe next 1 year including todays date ? Does this make sense - i really can't figure out how to do it, i only manage to find help in regards to the previous 12 months.Solved1.9KViews0likes1Comment