Forum Discussion
Create column with DAX which will provide latest data available
I want to create a column in power bi desktop which will show case only latest data available.
| Month | Year | Value |
| Jan | 2024 | 67 |
| Feb | 2024 | 23 |
| Mar | 2024 | 44 |
| Apr | 2024 | |
| May | 2024 |
|
i have data like this and i want to create a logic in such a way so that it will fethch whatever latest months data available in the column.
- Anonymous2 years ago
Hi, Anonymous
You can refer to amitchandak reply. If it does not help, you can try this.Data available within five months = VAR _lastestMonth = 5 VAR _availableDate = EOMONTH ( TODAY (), -6 ) + 1 VAR _flag = IF ( SELECTEDVALUE ( 'Table'[Date] ) >= _availableDate && SELECTEDVALUE ( 'Table'[Value] ) <> BLANK (), 1, 0 ) RETURN _flagBest Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
2 Replies
- amitchandakSuper User
Anonymous , In Power query you can use fill down
Power Query - Fill Up Fill Down: https://youtu.be/mC2ps0pFqBI
In DAX a new column, First have date column
Date = datevalue( "01-"& [Month] & "-" &[Year])
Now create a measure likeNew column =
var _max = maxx(filter(Table, [Date]< earlier([Date]) && not(isblank([Value]))) , [Date])
return
If(isblank([Value]) , Max(Filter(Table, Table[Date] =_max), [Value]) , [Value]) - AnonymousNot applicable
Hi, Anonymous
You can refer to amitchandak reply. If it does not help, you can try this.Data available within five months = VAR _lastestMonth = 5 VAR _availableDate = EOMONTH ( TODAY (), -6 ) + 1 VAR _flag = IF ( SELECTEDVALUE ( 'Table'[Date] ) >= _availableDate && SELECTEDVALUE ( 'Table'[Value] ) <> BLANK (), 1, 0 ) RETURN _flagBest Regards,
Yang
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!How to get your questions answered quickly -- How to provide sample data in the Power BI Forum