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

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.

Reply
evgenynartakhov
New Member

Need to create First Date measure for selected period range that does not change by month.

Hello,

 

I need to create a measure that shows "real" first selected date in the table with periods (month-year).

 

For example: My selected date range is May 2020 to Dec 2020. If I have M-Y in columns, first selected date will change for each period: for May-2020 it is May 1, for Jun-2020 it is June 1, ..., for Dec-2020 it is Dec 1. I need the first date to show Jan 1 in all periodic columns:

 

evgenynartakhov_0-1627498007116.png

 

How do I do that?...

 

 

Thank you in advance!

 

Evgeny

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @evgenynartakhov ,

 

Please try measure like below:

Measure = 
VAR MIN_DATE =  CALCULATE(MIN('Table'[Date]),ALLSELECTED('Table'))
VAR MONTH_DATE = CALCULATE(MIN('Table'[Date]),ALLSELECTED('Table'[Date]))
RETURN IF(MIN('Table'[Date])=MIN_DATE,DATE(YEAR(MIN_DATE),1,1),MONTH_DATE)

Vlianlmsft_0-1627893154728.png

 


Best Regards,
Liang
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

5 REPLIES 5
V-lianl-msft
Community Support
Community Support

Hi @evgenynartakhov ,

 

Please try measure like below:

Measure = 
VAR MIN_DATE =  CALCULATE(MIN('Table'[Date]),ALLSELECTED('Table'))
VAR MONTH_DATE = CALCULATE(MIN('Table'[Date]),ALLSELECTED('Table'[Date]))
RETURN IF(MIN('Table'[Date])=MIN_DATE,DATE(YEAR(MIN_DATE),1,1),MONTH_DATE)

Vlianlmsft_0-1627893154728.png

 


Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Fowmy
Super User
Super User

@evgenynartakhov 

Hope you have a dates table, create the following measure and add it:

1st Date =  STARTOFYEAR(Dates[Date])

Fowmy_0-1627502643909.png

 

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Thank you for the reply.

 

This gives me the first date in the calendar table, but not the first selected date... Date selections may also have multiple years, which complicates things more.

 

Regards,

 

Evgeny

@evgenynartakhov 
I did not understand that any how can you try this measure?

CALCULATE (
    MIN ( dates[Date]).
    REMOVEFILTERS (dates)
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Still getting the period first dates instead of just May 1, 2020 in all periodic clumns...

 

evgenynartakhov_0-1627505040027.png

 

Regards,

E

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.