cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Show entire month values using slicer date filter

Hi community!. I'm preety new in Power BI and I am facing a problem with dates.

 

I need to achieve that a table shows the entire month based on the selected date by the user.

 

For example if the user selects from 07-01-2018 to 08-20-2018 I have to show in my table from 07-01-2018 until 08-31-2018.

 

Anyone can help here??

 

Attached  is the link with my model.

 

Thanks in advanced!!!

 

https://www.dropbox.com/s/11rduwn9wifdlry/test1.pbix?dl=0

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

Re: Show entire month values using slicer date filter

So typically what you need to do is get your date from your slicer in a VAR using SELECTEDVALUE or MAX from your slicer. Then you want to get the MONTH from that in another VAR. Use that value to FILTER ALL of your table to where your MONTH of your date column equals your second VAR (month of your selected value from your slicer). So something like:

 

Spoiler
Measure = 
VAR __selectedDate = MAX('Table'[Date])
VAR __selectedMonth = MONTH(__selectedDate)
RETURN
SUMX(FILTER(ALL('Table'),MONTH('Table'[Date])=__selectedMonth),[Value])

---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




View solution in original post

1 REPLY 1
Highlighted
Super User IV
Super User IV

Re: Show entire month values using slicer date filter

So typically what you need to do is get your date from your slicer in a VAR using SELECTEDVALUE or MAX from your slicer. Then you want to get the MONTH from that in another VAR. Use that value to FILTER ALL of your table to where your MONTH of your date column equals your second VAR (month of your selected value from your slicer). So something like:

 

Spoiler
Measure = 
VAR __selectedDate = MAX('Table'[Date])
VAR __selectedMonth = MONTH(__selectedDate)
RETURN
SUMX(FILTER(ALL('Table'),MONTH('Table'[Date])=__selectedMonth),[Value])

---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




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

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
May 2020 Community Highlights

May 2020 Community Highlights

It’s time for another PBI Community recap!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Galleries

Galleries

Looking for inspiration on how to present your data? Need instructional videos? Check out our Galleries!

Top Solution Authors