Forum Discussion
Help with dax (most recent date)
yforti13 What do you mean "bring the most recent one" ? The most recent date, reference??
Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
What do you mean "bring the most recent one" ? The most recent date, reference??
-> Yes, the most recente reference.
The references (2 column) are repeated several times.
The new column needs to calculate:
1st -> If the reference is repeated in the same month.
2nd -> If it is repeated, bring the most recent reference based on the date.
For example:
in this case the reference is repeated, so the expected value is to bring the reference only in the line with the most recent date
Like this:
Did you understand?
- Fowmy1 year agoSuper User
yforti13
Please check if this works for you?New Ref = VAR __Refe = [Referencia] VAR __Date = [DataTransacaoHUB] VAR __Month = FILTER( ALLNOBLANKROW(Table01), FORMAT([DataTransacaoHUB],"mmyy") = FORMAT( __Date,"mmyy") && [DataTransacaoHUB] > __Date && [Referencia] = __Refe ) RETURN IF( ISEMPTY( __Month) , __Refe )I modifed your data to test.
- Ashish_Mathur1 year agoSuper User
Hi,
Will you be OK with a Power Query solution? If yes, then share the data in a format that can be pasted in an MS Excel file.
- yforti131 year agoRegular Visitor
Date Ref Expected Result 16/01/2025 13:01:22 001702731321 16/01/2025 18:15:05 001702731321 001702731321 23/01/2025 18:04:53 001744616718 001744616718 23/01/2025 17:11:05 001744616718 in this case the reference is repeated, so the expected value is to bring the reference only in the line with the most recent date
- Ashish_Mathur1 year agoSuper User
Hi,
PBI file attached.