Forum Discussion
Last date value - lastnonblank doesn't working
Hi KVPro
As lbendlin mentioned your post does not have enough information to go on;
But if I got your point correctly, try this code to add a new column to your table:
Column =
VAR _A =
CALCULATE (
MAX ( 'Table'[Month nr] ),
FILTER (
ALL ( 'Table' ),
'Table'[Local max] <> BLANK ()
&& 'Table'[Year] = EARLIER ( 'Table'[Year] )
&& 'Table'[Month nr] < EARLIER ( 'Table'[Month nr] )
)
)
VAR _B =
CALCULATE (
MAX ( 'Table'[Local max] ),
FILTER (
ALL ( 'Table' ),
'Table'[Year] = EARLIER ( 'Table'[Year] )
&& 'Table'[Month nr] = _A
)
)
RETURN
IF ( ISBLANK ( [Local max] ), _B, [Local max] )
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
- KVPro4 years agoFrequent Visitor
It is incorrect in more than one products, these is my sample of Data
I made it in real data by crossjoin products and SortID, I have a lot of products, so It is very very difficult to do
- Anonymous4 years agoNot applicable
Hi KVPro ,
It's easier to achieve in Power Query Editor.
1.Right click Product column, select group by. In operation, select All Rows.
2.Add a custom column.
= Table.FillDown([Count],{"Real Values"})3.Remove the Count column and expand the Custom column.
4.Replace null with 0.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- KVPro4 years agoFrequent Visitor
Hi
Table has been created crossjoin some tables in DAX, so I cannot do it in PowerQuery and I have to use dax functions 😞