Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
poojag820
Helper I
Helper I

Max Date Check

I need to calcuate max date flag against my data to show data in table only for latest month. 

Now the catch is that in my data future months are also available but data is only available till june month, so i need to calculate the max date flag only till June, it should not consider future date as max date. 

 

Thanks 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

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:

vjunyantmsft_0-1726815307385.png

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.

vjunyantmsft_1-1726815433523.png

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.

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

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:

vjunyantmsft_0-1726815307385.png

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.

vjunyantmsft_1-1726815433523.png

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.

bhanu_gautam
Super User
Super User

@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.




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






But my june month is not fixed it will keep on changing whenever data will loaded. that was just for the reference. 

@poojag820 , Can you explain on which logic it is going to change so that we can create it dynamci

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






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.

@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




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






this line 
RETURN IF('YourTable'[Date] = LatestMonthWithData, 1, 0)
is not readinf or taking Date col from my table. 

@poojag820 , Can you share sample data or PBIX




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.