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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
newlearnpbi123
Frequent Visitor

Get only one matching month and year of other date column

I have two date column,

one column has month-year and another column is weekend-dates, like below image

newlearnpbi123_0-1702132107017.png

 

 

i want to have only one matching month and year of the month column, like below

newlearnpbi123_1-1702132107020.png

 

 

the issue is starting of month and end of month sometimes present in previous month as highlighted in first image,

can someone help me get the result of 2nd image, any date is fine as long it is only one date matching the month column, so i could use it in  my slicer.

2 ACCEPTED SOLUTIONS
saurabhtd
Resolver II
Resolver II

@newlearnpbi123  You can create new column like

any date = DATE(YEAR('Calendar'[Month-Year]),MONTH('Calendar'[Month-Year]),1 )

Here we are creating new date column wheere year and month will ba taken from Year-Month column and Day will be 1. So they will be one date for each Month. You can keep Day as any other number between 0-28. 
saurabhtd_1-1702196840032.png

 

View solution in original post

v-junyant-msft
Community Support
Community Support

Hi @newlearnpbi123 ,

You can try this way:
Here is my sample date:

vjunyantmsft_0-1702446474371.png

I use these DAXs below to create two new columns to extract year and month:

Year = YEAR('Table'[Date])
Month = MONTH('Table'[Date])

vjunyantmsft_1-1702446611960.png

Then I use this DAX to create a new table to achieve your purpose:

Slicer = 
SUMMARIZE(
    'Table',
    'Table'[Year],
    'Table'[Month],
    "slicer",
    MIN('Table'[Date])
)

vjunyantmsft_2-1702446697862.png


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

2 REPLIES 2
v-junyant-msft
Community Support
Community Support

Hi @newlearnpbi123 ,

You can try this way:
Here is my sample date:

vjunyantmsft_0-1702446474371.png

I use these DAXs below to create two new columns to extract year and month:

Year = YEAR('Table'[Date])
Month = MONTH('Table'[Date])

vjunyantmsft_1-1702446611960.png

Then I use this DAX to create a new table to achieve your purpose:

Slicer = 
SUMMARIZE(
    'Table',
    'Table'[Year],
    'Table'[Month],
    "slicer",
    MIN('Table'[Date])
)

vjunyantmsft_2-1702446697862.png


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.



saurabhtd
Resolver II
Resolver II

@newlearnpbi123  You can create new column like

any date = DATE(YEAR('Calendar'[Month-Year]),MONTH('Calendar'[Month-Year]),1 )

Here we are creating new date column wheere year and month will ba taken from Year-Month column and Day will be 1. So they will be one date for each Month. You can keep Day as any other number between 0-28. 
saurabhtd_1-1702196840032.png

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors