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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Rubal_Islam
Helper II
Helper II

Need help with- Max Date vs Current Month

Hi Braintrust,

 

Need your help with the below DAX.

 

It is currently returning 1 or 0 if the date is  Max date.
However, I would like it to return 1 if the date is the current month and 0 for all the months from the selected months.

 

Last Sale Period =
VAR LastSale = CALCULATE(MAX(dim_date[full_date]), ALLSELECTED(fact_jedox_invoices))
RETURN
IF(
    DATE(YEAR(LastSale), MONTH(LastSale),1) =
    DATE(YEAR(MAX(dim_date[full_date])), MONTH(MAX(dim_date[full_date])),1),
    1, 0)
 
Max Date vs Current Month.png
1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

pls try

if(year(max(dim_date[full_date]))=year(today())&&month(max(dim_date[full_date]))=month(today()),1,0)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

pls try

if(year(max(dim_date[full_date]))=year(today())&&month(max(dim_date[full_date]))=month(today()),1,0)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




hi Ryan, it works fine. thank you soo much for your help. legend.

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.