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
timknox
Helper II
Helper II

Create a table of dates based on slicer selection to give start and end dates

hi,

I am new to PowerBI so would welcome some help please!

 

nameTable:

 

NameStart DateEnd Date
John01/05/201223/05/2023
Paul25/09/201501/06/2024
Peter31/03/201602/09/2021
Iain01/08/201303/08/2026

 

I have a simple table (called nameTable), and a slicer based on the column:  Name

 

What i am trying to create is also a Date Slicer linked to a calendar table, where the start and end date comes from my nameTable.

 

So basically, if i select Paul in the slicer, a seperate Date Slicer will have the Start and End dates 25/8/2015 and 01/06/2024 respectively.

 

Welcome any help....

 

Many thanks

 

Tim

1 ACCEPTED SOLUTION

This is the closest I can get to dynamic date.

I see no way to have this in a slicer because it doesn't work with measures, sorry about that!

 

View solution in original post

8 REPLIES 8
dujos
Helper I
Helper I

Hello team, i don't know if this will works as you want but try to do this:

 

I have used 3 Slices - First for Name Column, second for Start Date and Third for End Date Column. After this i have put a Square form without fill so the result is showed in image below:

img1.png

 

After creating this elements you have to Edit interaction of Stard Date Slicer and End Date Slicer to Name Slicer as showed as follow:

img2.png

 

After this, when you select a name on Name Slicer for example John, the result is that:

 

 

img3.png

I have selected John and the Slicer Start Date and End Date are showing only the dates of John.

 

I hope i've helped.

 

Thanks for that.......

 

I really did not want to have another slicer......

 

I was trying to do it with this:

 

Table =

VAR StartDate= Selector[Start Date]
VAR EndDate= Selector[End Date]

RETURN

 

CALENDAR(StartDate,EndDate)

 

 

It works with the Start Date (if i replace the above with VAR EndDate="31/3/2022") but not as detailed above!

 

I am getting so frustrated!

 

Any help please.......

 

Thanks

Hi @timknox

Unfortunately that won't work using a table, it is loaded once and slicers won't affect it.

 

Also, Slicer only work with column value. However you could have a table chart with your date field and a measure as a visual filter, would that do?

 

 

is it possible to show me how to do that - sorry i am not good at this!

Sure,

Have a look at the pbix in the link

 

https://1drv.ms/u/s!As5oZCclkGkWgSTanlDS9mHENg4u

 

I have created the following measure

Is In Date Range =
IF(
AND(SELECTEDVALUE('CALENDAR'[Date])>=MIN(Employee[Start Date]),
SELECTEDVALUE('CALENDAR'[Date])<=MAX(Employee[End Date])
),
"Y",
"N"
)

 

Beware that if you select two employees or more, your date range will be the earliest/latest of any of them combined. You could use SELECTEDVALUE to go for an alternative value.

 

I have added this measure to a table chart and have a filter on the visual.

image.png

 

image.png

Wow - i think you have nearly solved it!

 

Can i now turn that into a date slicer?

This is the closest I can get to dynamic date.

I see no way to have this in a slicer because it doesn't work with measures, sorry about that!

 

LivioLanzo
Solution Sage
Solution Sage

what is the end goal?

 


 


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


Proud to be a Datanaut!  

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.