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
Anonymous
Not applicable

Date Slicer with DAX calculation

Hi,

 

i have a date table containg many dates (incremantaly).

 

i wish to create a culomn that will allow me to create a slicer with the current groups.

 

for the current month( MAR-2020) it will show "This Month"

 

for the FEB -2020 it will Show "Show Last Month"

 

for the 6 month before FEB -2020 show in the last 6 month before last month(FEB-2020)"

for the months : Jan-2020,Dec-2019,Nov-2019,Oct-2019 ,Sep-2019,Aug-2019 :in the last 6 month before last month(FEB-2020)"

 

see below example:

Date(from Date table)(DD-MM-YY)Month&Year(MM-YY)Group
1/3/2020Mar-20Current Month
1/2/2020Feb-20Last month
1/1/2020Jan-20In the last 6 Months
1/12/2019Dec-19In the last 6 Months
1/11/2019Nov-19In the last 6 Months
1/10/2019Oct-19In the last 6 Months
1/9/2019Sep-19In the last 6 Months
1/8/2019Aug-19In the last 6 Months
1/7/2019Jul-19Other months
1/6/2019Jun-19Other months
1/5/2019May-19Other months

 

 

 

thanks!

 

 

 

 

 

 

 

 

 

4 REPLIES 4
Anonymous
Not applicable

why do want like this column?

 

There is already feature "relative date" for date slicers where you can select today last N month/Year/Days.

 

Make your slicer as relative date slicer.

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

Anonymous
Not applicable

hi,

 

the reason i want is as a coulmn since the costumer want to have a slicer botton on the report that will able him to filter the page for each period

 

current month

previus month

 

last 6 months before previus month

 

thanks

 

 

Anonymous
Not applicable

one solution is here.

https://community.powerbi.com/t5/Desktop/Date-Selector-interaction-with-Date-Slicer/m-p/963412#M4616...

 

but when you mark you date slicer as relative it will allow your end user to select particular time span like last 6 months,today, this week.

 

Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

The below blog post explains how to achieve this with use of query editor, it returns 0 for the current month and -1 for previous and so on, later you can add a column converting numbers to text.

https://community.powerbi.com/t5/Community-Blog/Relative-Date-Dimension/ba-p/779039

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

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.

Top Solution Authors