Forum Discussion
Find the last value
Hello,
I have a table with 3 colums : Site / Date / Result
I want to find the results associated to the last date of each site, to create an histogram with the last result per site.
Example :
FRANCE - 1/2/21 - 23
FRANCE - 1/4/21 - 54
FRANCE - 1/6/21 - 60
BELGIUM - 3/5/21 - 10
BELGIUM - 15/5/21 - 12
BELGIUM - 28/5/21 - 20
SPAIN - 12/3/21 - 12
SPAIN - 13/4/21 - 24
SPAIN - 15/5/21 - 30
What I want (Histogram) :
6 2 3
0 0 0
FRANCE BELGIUM SPAIN
Can you help me please ?
Hey Gwen78 ,
In Dax you can use the MAXX with the date as well. This link has a more in-depth review than you probably need but under number 4 it specifically calls out using the Maxx Date. Using MAXX DAX Function In Power BI To Calculate Recent Values (enterprisedna.co)
4 Replies
- collinqSuper User
Hi Gwen78 ,
If you are doing this in Dax, I would think that the MAXX command would do the trick. If you are doing this in M a group with Max on the Date would do the trick.
Here are some examples:
MAXX function (DAX) - DAX | Microsoft Docs
- Gwen78New Member
Thank you collinq for your answer.
My example is not good. I don't search the largest value but the value related to the last date. Instead of 60 for France - 1/6/21 it could also be 9 for example.
I have created a measure lastdate() to find the last date and it works, but I cannot use the related fonction in a measure.- collinqSuper User
Hey Gwen78 ,
In Dax you can use the MAXX with the date as well. This link has a more in-depth review than you probably need but under number 4 it specifically calls out using the Maxx Date. Using MAXX DAX Function In Power BI To Calculate Recent Values (enterprisedna.co)