Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey,
Is there a function to get the last value in a row?
Example PrimaryKey / Date1/ Date2/ Date3/ Date4 xx1 / 28.01.2020 / 01.01.2020
xx2 / 02.02.1922/ 10.08.2022/ 03.04.2011
DAX function last value for xx1 = 01.01.2020 For xx2 = 03.04.2011
Thanks a lot
marius
Solved! Go to Solution.
Hi @MM1984 ,
According to your description, here's my solution.
1.In Power Query, select all date columns at the same time, then click Unpivot Columns.
Get the following table.
2.Add an index column.
3.Create a measure.
Last date=
MAXX (
FILTER (
'Table',
'Table'[Index]
= MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[PrimaryKey] = MAX ( 'Table'[PrimaryKey] )
&& 'Table'[Value] <> BLANK ()
),
'Table'[Index]
)
),
'Table'[Value]
)
4.Put PrimaryKey and the measure in a table visual, get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @MM1984 ,
According to your description, here's my solution.
1.In Power Query, select all date columns at the same time, then click Unpivot Columns.
Get the following table.
2.Add an index column.
3.Create a measure.
Last date=
MAXX (
FILTER (
'Table',
'Table'[Index]
= MAXX (
FILTER (
ALL ( 'Table' ),
'Table'[PrimaryKey] = MAX ( 'Table'[PrimaryKey] )
&& 'Table'[Value] <> BLANK ()
),
'Table'[Index]
)
),
'Table'[Value]
)
4.Put PrimaryKey and the measure in a table visual, get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
There isn't a direct function. In these kind of cases I would unpivot the data and use LASTNONBLANK while considering the key as a filter.
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
42 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
39 | |
33 | |
18 | |
17 |