Forum Discussion
Max Date Check
- Anonymous1 year ago
Hi poojag820 ,
Thanks for bhanu_gautam's reply!
And poojag820 , please try this way:
Not sure if your data looks like this, this is my test data:Use this DAX to create a measure:
Flag = VAR _Date = CALCULATE( MAX('Table'[Date]), ALL('Table'), 'Table'[Value] <> BLANK() ) RETURN IF( MONTH(MAX('Table'[Date])) = MONTH(_Date) && YEAR(MAX('Table'[Date])) = YEAR(_Date), 1, 0 )Then all rows corresponding to the largest month in the table where Value exists will be marked as 1, and the others as 0.
You can then filter to show only data with measure=1.
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
poojag820 , Create a new calculated column for this using
MaxDateFlag =
VAR MaxDate = CALCULATE(MAX('YourTable'[Date]), 'YourTable'[Date] <= DATE(2024, 6, 30))
RETURN IF('YourTable'[Date] = MaxDate, 1, 0)
Then Add a filter to your visual to only show rows where MaxDateFlag is 1.
But my june month is not fixed it will keep on changing whenever data will loaded. that was just for the reference.
- bhanu_gautam1 year agoSuper User
poojag820 , Can you explain on which logic it is going to change so that we can create it dynamci
- poojag8201 year agoHelper I
I am using this logic currently, without max flag but using max logic inside dax
Sales = CALCULATE(sum(Sales),Sales[Period] = max(Sales[Period]) -- Filter to the max month)
I am showing data against serveral fields like Client, PRoject.- bhanu_gautam1 year agoSuper User
poojag820 , Update the measure
MaxDateFlag =
VAR LatestMonthWithData =
CALCULATE(
MAX('YourTable'[Date]),
'YourTable'[Date] <= TODAY()
)
RETURN IF('YourTable'[Date] = LatestMonthWithData, 1, 0)Then rest process is same