max date
16 TopicsCalculated column with MAX value
Hi, I am so lost. I dont really know how I would search for a simular problem since i dont know how to explain it without a visual aid. I am trying to get the value from the row with the latest date. (Row.2) Row.1 is the actuall event date (delivery date), I need to get the latest Real_TB1 in a calculated column Get Latest Real_TB1 (the last column) Somehow I guess I need to use use MAX EventDate where VehicleNumber = VehicleNumber and then get Real_TB1 from that. This table has around 300.000 rows Calculated Col EventDate Delivery_count Invoice_count Order_count Real_TB1 VehicleNumber Get Latest Real_TB1 20230324 1 1 1 15958 00086348 17418 20230329 0 0 0 17418 00086348 17418 20230325 0 0 0 17418 00086348 17418Solved1.6KViews0likes4CommentsValue of latest update for each measure when last update was in a different month
Hello Community, What DAX function would you recommend to get the value corresponding to latest update of a list of KPIs where some of these KPIs are measured on monthly? Some are monthly, others quarterly and so on. Note that the latest date in Last Update column is different for each metric. I can't use a formula where the Metric is defined as a string (i.e. "A") because the metrics have long descriptions (some with more than 20 words) and my dataset has hundreds of different metrics. The only solution I found so far is "slice" the data set in multiple smaller tables and it is getting impossible manage everything. I appreciate any suggestion or ideas. KRSolved728Views0likes3CommentsCalculate filter not working when adding dimension
Good morning, Firstly, wishing you a merry x-mas! π I'm working on a dashboard that it has to show different measures based on different subsets. There's a database with rows representing actions. All the rows have a column named Date that shows the date of the game. The subsets are: Last_Game = MAX(database[Date]) Other_Games = database[Date] <> MAX(database[Date]) So, to represent the data of the last game, I used: Pts/G_Last = CALCULATE([Pts/G], database[Date] = MAX(database[Date])) * With this CALCULATE, I take, from all games, the measure [Pts/G] for the subset created for the database[Date] = MAX(database[Date]) This is working when I represent the data alone but not when I add a column to see the same amount [Pts/G] separated by that column/dimension. The example below: - When using the measure alone, the expected result is correct (78). (Image 1) - When adding the dimension, the total is changing to show all games, ignoring the calculate filter. I tried also with KEEPFILTERS but not working [Pts/G_Last = CALCULATE([Pts/G], KEEPFILTERS(database[Date] = MAX(database[Date])))]. (Image 2) Could anyone tell me how I could do it, please? Thank you in advance.Solved897Views0likes2CommentsDax formula for only showing the max date when all activities has been completed
Hello, I have not been able to find a solution for this yet, so I would appreciate if someone could guide me a bit towards a solution. So I have formula that gives me the max date and that works fine. However, I am using a slicer that containts planning activities for a product. At a point in time, the product is finish (all activities are completed). That takes time, and bit by bit activities are completed. What I need is my max date card / dax to, is to only show the max date when all activities are completed. Cheers, CarstenSolved5.3KViews0likes4CommentsCalculation revenue for the last date
Hi, I am a bit lost concerning the use of MAX with dates. I thought it would be possible to use a dynamic max date and then combine it with a calculate revenue function. Here is my issue: I need a measure that takes into account only the freshest date in my data set. So in this case, for project release it needs to return only the revenue for the 2nd of December 2020. But filtering my revenue with the max date delivers an error. I am still new at DAX and getting confused by all the possibilities. How should I approach this? Thanks! Pauline.Solved865Views0likes2CommentsMax function showing wrong. Need help for Powerbi Matrix total
Hello everyone, I need your support to solve and understand issues in my DAX. I have a transactionDB of all bank transaction like below: date company type Source Bank amount 01-Apr-22 Company 1 Credit Bank Bank A 10000 01-Apr-22 Company 1 Credit Bank Bank B 10000 01-Apr-22 Company 1 Debit Bank Bank B 500 01-Apr-22 Company 2 Credit Bank Bank C 10000 01-Apr-22 Company 2 Credit Bank Bank D 10000 01-Apr-22 Company 2 Debit Bank Bank C 10000 02-Apr-22 Company 1 Debit Bank Bank A 3000 02-Apr-22 Company 1 Debit Bank Bank B 1000 03-Jun-22 Company 2 Credit Bank Bank D 30000 03-Apr-22 Company 1 Credit Bank Bank A 5000 03-Apr-22 Company 2 Credit Bank Bank C 60000 03-Apr-22 Company1 Debit Bank Bank A 2000 03-Apr-22 Company 2 Debit Bank Bank C 10000 03-Apr-22 Company 2 Debit Bank Bank D I want to build a Dashboard with Matrix like below. Users wants to see today (slider date 3/06/2022) 1. Opening balance of 03/06/2022 (sum of all debit - credit as of of 2/06/2022) 2. Sum of credit happened on 03/06/2022 3. Sum of debit happened on 03/06/2022 4. Closing balance of 03/06/2022 If the user changes the date slider to 2/06/202, they will see above status as of 02/06/2022 Solution 1. Opening Measure (This is working fine with slider and all values) CALCULATE( SUM(transactionDB[Amount]), FILTER(ALLSELECTED(transactionDB[date]), ISONORAFTER(transactionDB[date],MAX(transactionDB[date])-1,DESC))) 2. Credit (Matrix is showing wrong calculation) CALCULATE( SUM(transactionDB[credit]),FILTER(ALLSELECTED(transactionDB[date]),transactionDB[date] = MAX( transactionDB[date]))) I want to show the credit happened in Slider date ie. 03/06/2022. It is not working as expected. 3. Debit(Matrix is showing for wrong calculation) CALCULATE( SUM(transactionDB[debit]),FILTER(ALLSELECTED(transactionDB[date]),transactionDB[date] = MAX( transactionDB[date]))) I want to show the debit happened in Slider date ie. 03/06/2022. It is not working as expected. 4. Ending balance (This is working fine with slider and all values) CALCULATE( SUM(transactionDB[Amount]), FILTER( ALLSELECTED(transactionDB[date]), ISONORAFTER(transactionDB[date], MAX(transactionDB[date]), DESC) ) ) Please help to solve this issue. I understand that using max function will summarize the value based on maximum date filtered within its context. But i would like to show the debit or credit happened for that particular date as per date slider ChandeepChhabra GuyInACube johnt75 tamerj11.1KViews0likes2CommentsGet the max value per date based in serial
I have 3 fields Serial, Date and Temp. The date field is actually a date time field I converted to just a date. I am trying to get the max Temp per date for each serial number. In the past I have done this to get the max date of each serial and filter on only the columns with 1. Max Date = IF('Export'[datetime]=CALCULATE(MAX('Export'[datetime]),ALLEXCEPT('Export','Export'[serialnumber])),1,0) The complexity here is adding the Temp. I need to flag each row somehow that this is the max temp for that serial on that day. Here is a sample of what I am trying to do. I dont necessarly need a max temp column with 1,0 but that how I was able to do it before.Solved530Views0likes1CommentMax date in a column
Hi All, I have a date column called FileDate, and I'm trying to get the latest date in that column. I've tries using MAX or LASTDATE in the following ways: maxFileDate = LASTDATE(('myTable'[FileDate].[Date]) maxFileDate = MAX('myTable'[FileDate].[Date]) maxFileDate = CALCULATE(MAX('myTable'[FileDate].[Date]), All()) All return 12/31/2021 although the last date in that column is Nov 9th What am I missing here? Thanks for the help!Solved1.8KViews0likes5CommentsCount how many workdays that are from Min and Max value of the slicer
Hi there, I've been struggling with this one for a few days and wonder if someone can help. I have a slicer with a date dimension "created_date", and I'm looking to get the count of how many working days are between the min and max value of the "created_date". I've done two things: Created a column with: WorkWeekDays = IF(WEEKDAY(CASES[Weekdays])>=6,FALSE,TRUE) This works well: one the "weekdays" I have: Weekdays = WEEKDAY(CASES[created_date],2) Created a CCountWorkDays" measure with The calculation below: CountWorkDays = VAR FirstDay = CALCULATE(MIN('CASES'[created_date]), ALLSELECTED('CASES'[created_date])) VAR LASTDAY = CALCULATE(MAX('CASES'[created_date]), ALLSELECTED('CASES'[created_date])) var Weekdays = COUNTROWS(FILTER(CASES, CASES[WorkWeekDays] = FALSE())) RETURN DATEDIFF(FirstDay,LASTDAY,DAY) --- I realise I am not comparing it to the "Weekdays" var but haven't found a good way to do so. Any ideas?Solved4.1KViews0likes12CommentsSum previous complete week and return zero for schools that had no values in previous week
I am trying to sum the number of positive COVID cases at local schools for the most recent complete week (a complete week ending on Sunday). I update the data each week so I am trying to build a formula that updates the βnew cases last weekβ value automatically. The challenges: Some schools report new cases daily while others do not report any data for an entire week. For schools that did not report anything the previous week, my (broken) formula returns the value from the most recent week available for that school, even if it is not from the previous week. That is not what I want! If a school made no reports last week, Iβd like the formula to return β0β. The MAX function and LASTDATE function filter to the last week of data in my dataset, but I run this report on Wednesday so the MAX date and LASTDate target the incomplete current week. I want the most recent complete week of data. In the end, I want a table with a row for each school that shows the number of total cases and the number of new cases last week. I tried many, many calculations. Here are a couple of my failures. I was trying to use minus 7 to bring me to the previous complete week. In the second example, I use a date table. Example 1 NEW positive_ALL = CALCULATE(SUM(schools[positive_all]), LASTDATE(schools[Week end date]-7)) Example 2 NEW positive_ALL = CALCULATE(SUM(AllSchools[positive_ALL]),('AllSchools'[Week end date]= (MAX(Datetable[WeekEndDate]-7)))) Here is a link to some sample data I uploaded on WeTransfer. In the sample, there are at least two schools, Emma Willard and Catholic Central High, that did not submit data for the most recent week, which ended on Oct. 31. Thanks for any guidance you may provide.Solved938Views0likes2Comments