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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
kai1109
Frequent Visitor

Flag if the date selected in the slicer is between the start and end dates

I'm sorry if it's hard to see because I type with the translation function
ProjectTaskStartdateEndate
Ae2023/4/272023/4/29
Af2023/5/12023/5/4
Ag2023/5/52023/5/7
Be2023/4/282023/4/29
Bf2023/5/22023/5/4
Bg2023/5/32023/5/7
Here's a sample of the data above
When selecting 2023/5/6 with slicer
I want to flag the third and sixth lines as shown in the image below.
 スクリーンショット 2023-05-11 164203.png
When selecting 2023/5/6, the ideal shape is the table below.
Somebody help me, please
Projectnametaskname

A

g

B

g
 
Please let me know if there is any way to do both

formula someone was trying to calculate
value =
VAR SelectedDate = SELECTEDVALUE('calender'[Date])
RETURN
IF(
SelectedDate <> BLANK() &&
COUNTROWS(
FILTER(
'test',
'test'[StartDate] <= SelectedDate &&
'test'[Enddate] >= SelectedDate
)
) > 0,
1,
0
)
 
 
1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @kai1109 ,

Please have a try.

  1. Create another calendar table without relationship with the table.
  2. Then put the calendar date into the slicer.
  3. Create a measure.
Measure =
VAR _1 =
    SELECTEDVALUE ( 'Table'[Date] )
RETURN
    IF (
        _1 >= SELECTEDVALUE ( 'Project Task Startdate EndateTable'[Startdate] )
            && _1 <= SELECTEDVALUE ( 'Project Task Startdate EndateTable'[Endate] ),
        1,
        0
    )

 4.Then filter the table.

vrongtiepmsft_0-1684130893873.png

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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
kai1109
Frequent Visitor

Thank you.It's solved!
 
v-rongtiep-msft
Community Support
Community Support

Hi @kai1109 ,

Please have a try.

  1. Create another calendar table without relationship with the table.
  2. Then put the calendar date into the slicer.
  3. Create a measure.
Measure =
VAR _1 =
    SELECTEDVALUE ( 'Table'[Date] )
RETURN
    IF (
        _1 >= SELECTEDVALUE ( 'Project Task Startdate EndateTable'[Startdate] )
            && _1 <= SELECTEDVALUE ( 'Project Task Startdate EndateTable'[Endate] ),
        1,
        0
    )

 4.Then filter the table.

vrongtiepmsft_0-1684130893873.png

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

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

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.