Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I want to create a measure to say "yes" or "no".
Whether the date is falling between start and end date.
I have column "dataonly", - this column needs to be checked whether the date is falling between startdate adn enddate.
As a outcome, if yes - then the measure should show yes, no mean no.
I need a measure because this is a visual will be changing dyanmically. So i need a measure that dynamically says yes or no.
Solved! Go to Solution.
Hi @pavithrarajan ,
If you want to check whether the date is between range dynamiclly by slicer or filter, I suggest you to create an unrelated DimPeriod table to help calculation.
DimPeriod = FILTER(VALUES('Time'[Period]),[Period]<>BLANK())
Then create a measure to achieve your goal.
Measure =
VAR _TimeList = CALCULATETABLE('Time',FILTER(ALLSELECTED('Time'),'Time'[Period] in VALUES('DimPeriod'[Period])))
VAR _Flag = ADDCOLUMNS(_TimeList,"Flag",IF(MAX(A[DateOnly]) >= [StartDate] && MAX(A[DateOnly]) <= [EndDate],1,0))
RETURN
IF(SUMX(_Flag,[Flag]) = 1,"Yes","No")
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Assuming all these columns are from the same table:
IF (
SELECTEDVALUE ( 'table'[DateOnly] ) >= SELECTEDVALUE ( 'table'[StartDate] )
&& SELECTEDVALUE ( 'table'[DateOnly] ) <= SELECTEDVALUE ( 'table'[EndDate] ),
"Yes",
"no"
)
Otherwise, please provide a workable sample data (not an image) and more context.
Proud to be a Super User!
Table A:
Name | Date modified | DateOnly |
d | 10/01/2024 13:03 | 10-Jan-24 |
d | 10/01/2024 13:48 | 10-Jan-24 |
d | 08/11/2023 08:52 | 08-Nov-23 |
d | 08/11/2023 08:52 | 08-Nov-23 |
d | 08/11/2023 08:52 | 08-Nov-23 |
d | 08/11/2023 08:52 | 08-Nov-23 |
d | 08/11/2023 08:52 | 08-Nov-23 |
d | 08/11/2023 08:52 | 08-Nov-23 |
d | 06/12/2023 09:45 | 06-Dec-23 |
d | 06/12/2023 09:45 | 06-Dec-23 |
d | 06/12/2023 09:45 | 06-Dec-23 |
d | 06/12/2023 09:45 | 06-Dec-23 |
d | 06/12/2023 09:45 | 06-Dec-23 |
d | 04/01/2024 05:24 | 04-Jan-24 |
d | 31/01/2024 12:39 | 31-Jan-24 |
d | 05/01/2024 07:55 | 05-Jan-24 |
d | 07/02/2024 00:41 | 07-Feb-24 |
d | 05/01/2024 07:55 | 05-Jan-24 |
d | 05/01/2024 07:55 | 05-Jan-24 |
d | 05/01/2024 07:55 | 05-Jan-24 |
d | 29/02/2024 02:52 | 29-Feb-24 |
d | 01/02/2024 12:10 | 01-Feb-24 |
d | 01/02/2024 12:10 | 01-Feb-24 |
d | 01/02/2024 12:10 | 01-Feb-24 |
d | 02/02/2024 10:16 | 02-Feb-24 |
d | 28/02/2024 10:00 | 28-Feb-24 |
d | 29/02/2024 08:57 | 29-Feb-24 |
d | 28/02/2024 10:00 | 28-Feb-24 |
d | 28/02/2024 10:00 | 28-Feb-24 |
d | 28/02/2024 10:00 | 28-Feb-24 |
d | 29/02/2024 02:42 | 29-Feb-24 |
d | 07/11/2023 17:10 | 07-Nov-23 |
d | 08/11/2023 09:37 | 08-Nov-23 |
d | 05/12/2023 18:11 | 05-Dec-23 |
d | 10/01/2024 13:51 | 10-Jan-24 |
d | 03/01/2024 10:26 | 03-Jan-24 |
d | 10/01/2024 13:52 | 10-Jan-24 |
d | 30/01/2024 18:21 | 30-Jan-24 |
d | 06/02/2024 12:24 | 06-Feb-24 |
d | 27/02/2024 18:01 | 27-Feb-24 |
d | 19/01/2024 10:15 | 19-Jan-24 |
d | 19/01/2024 10:10 | 19-Jan-24 |
d | 19/01/2024 10:06 | 19-Jan-24 |
d | 30/01/2024 08:40 | 30-Jan-24 |
d | 10/01/2024 09:51 | 10-Jan-24 |
d | 22/12/2023 15:49 | 22-Dec-23 |
d | 01/11/2023 20:01 | 01-Nov-23 |
d | 30/11/2023 19:24 | 30-Nov-23 |
d | 13/12/2023 10:40 | 13-Dec-23 |
d | 02/01/2024 21:07 | 02-Jan-24 |
d | 24/01/2024 17:03 | 24-Jan-24 |
d | 30/01/2024 12:27 | 30-Jan-24 |
d | 31/01/2024 13:16 | 31-Jan-24 |
d | 16/02/2024 13:20 | 16-Feb-24 |
d | 19/02/2024 12:44 | 19-Feb-24 |
d | 19/02/2024 16:57 | 19-Feb-24 |
d | 19/02/2024 17:02 | 19-Feb-24 |
a | 01/11/2023 19:45 | 01-Nov-23 |
c | 10/11/2023 16:37 | 10-Nov-23 |
a | 04/12/2023 13:53 | 04-Dec-23 |
a | 08/12/2023 11:00 | 08-Dec-23 |
a | 10/01/2024 09:52 | 10-Jan-24 |
c | 08/12/2023 14:17 | 08-Dec-23 |
a | 02/01/2024 21:33 | 02-Jan-24 |
c | 05/01/2024 06:43 | 05-Jan-24 |
a | 24/01/2024 16:59 | 24-Jan-24 |
c | 02/02/2024 15:35 | 02-Feb-24 |
a | 19/02/2024 15:58 | 19-Feb-24 |
table PERIOD:
Date DateOnly period
03/12/2023 00:00 03-Dec-23 23_13
04/12/2023 00:00 04-Dec-23 23_13
05/12/2023 00:00 05-Dec-23 23_13
06/12/2023 00:00 06-Dec-23 23_13
07/12/2023 00:00 07-Dec-23 23_13
08/12/2023 00:00 08-Dec-23 23_13
09/12/2023 00:00 09-Dec-23 23_13
10/12/2023 00:00 10-Dec-23 23_13
11/12/2023 00:00 11-Dec-23 23_13
12/12/2023 00:00 12-Dec-23 23_13
13/12/2023 00:00 13-Dec-23 23_13
14/12/2023 00:00 14-Dec-23 23_13
15/12/2023 00:00 15-Dec-23 23_13
16/12/2023 00:00 16-Dec-23 23_13
17/12/2023 00:00 17-Dec-23 23_13
18/12/2023 00:00 18-Dec-23 23_13
19/12/2023 00:00 19-Dec-23 23_13
20/12/2023 00:00 20-Dec-23 23_13
21/12/2023 00:00 21-Dec-23 23_13
22/12/2023 00:00 22-Dec-23 23_13
23/12/2023 00:00 23-Dec-23 23_13
24/12/2023 00:00 24-Dec-23 23_13
25/12/2023 00:00 25-Dec-23 23_13
26/12/2023 00:00 26-Dec-23 23_13
27/12/2023 00:00 27-Dec-23 23_13
28/12/2023 00:00 28-Dec-23 23_13
29/12/2023 00:00 29-Dec-23 23_13
30/12/2023 00:00 30-Dec-23 23_13
01/12/2023 00:00 01-Dec-23 23_12
02/12/2023 00:00 02-Dec-23 23_12
31/12/2023 00:00 31-Dec-23 23_01
28/01/2024 00:00 28-Jan-24 24_02
29/01/2024 00:00 29-Jan-24 24_02
30/01/2024 00:00 30-Jan-24 24_02
31/01/2024 00:00 31-Jan-24 24_02
01/01/2024 00:00 01-Jan-24 24_01
02/01/2024 00:00 02-Jan-24 24_01
03/01/2024 00:00 03-Jan-24 24_01
04/01/2024 00:00 04-Jan-24 24_01
05/01/2024 00:00 05-Jan-24 24_01
06/01/2024 00:00 06-Jan-24 24_01
07/01/2024 00:00 07-Jan-24 24_01
08/01/2024 00:00 08-Jan-24 24_01
09/01/2024 00:00 09-Jan-24 24_01
10/01/2024 00:00 10-Jan-24 24_01
11/01/2024 00:00 11-Jan-24 24_01
12/01/2024 00:00 12-Jan-24 24_01
13/01/2024 00:00 13-Jan-24 24_01
14/01/2024 00:00 14-Jan-24 24_01
15/01/2024 00:00 15-Jan-24 24_01
16/01/2024 00:00 16-Jan-24 24_01
17/01/2024 00:00 17-Jan-24 24_01
18/01/2024 00:00 18-Jan-24 24_01
19/01/2024 00:00 19-Jan-24 24_01
20/01/2024 00:00 20-Jan-24 24_01
21/01/2024 00:00 21-Jan-24 24_01
22/01/2024 00:00 22-Jan-24 24_01
23/01/2024 00:00 23-Jan-24 24_01
24/01/2024 00:00 24-Jan-24 24_01
25/01/2024 00:00 25-Jan-24 24_01
26/01/2024 00:00 26-Jan-24 24_01
27/01/2024 00:00 27-Jan-24 24_01
TABLE TIME:
Period | StartDate | EndDate |
23_10 | 10-Sep-23 | 07-Oct-23 |
23_11 | 08-Oct-23 | 04-Nov-23 |
23_12 | 05-Nov-23 | 02-Dec-23 |
23_13 | 03-Dec-23 | 30-Dec-23 |
24_01 | 31-Dec-23 | 27-Jan-24 |
24_02 | 28-Jan-24 | 24-Feb-24 |
24_03 | 25-Feb-24 | 23-Mar-24 |
24_04 | 24-Mar-24 | 20-Apr-24 |
24_05 | 21-Apr-24 | 18-May-24 |
24_06 | 19-May-24 | 15-Jun-24 |
24_07 | 16-Jun-24 | 13-Jul-24 |
24_08 | 14-Jul-24 | 10-Aug-24 |
24_09 | 11-Aug-24 | 07-Sep-24 |
24_10 | 08-Sep-24 | 05-Oct-24 |
24_11 | 06-Oct-24 | 02-Nov-24 |
24_12 | 03-Nov-24 | 30-Nov-24 |
MODEL:
vISUAL"
Hi @pavithrarajan ,
If you want to check whether the date is between range dynamiclly by slicer or filter, I suggest you to create an unrelated DimPeriod table to help calculation.
DimPeriod = FILTER(VALUES('Time'[Period]),[Period]<>BLANK())
Then create a measure to achieve your goal.
Measure =
VAR _TimeList = CALCULATETABLE('Time',FILTER(ALLSELECTED('Time'),'Time'[Period] in VALUES('DimPeriod'[Period])))
VAR _Flag = ADDCOLUMNS(_TimeList,"Flag",IF(MAX(A[DateOnly]) >= [StartDate] && MAX(A[DateOnly]) <= [EndDate],1,0))
RETURN
IF(SUMX(_Flag,[Flag]) = 1,"Yes","No")
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
i am not able to add pbix or excel here
I dont get the use of Table Period but is this what you're looking for?
Proud to be a Super User!
You can post a link to a cloud storage.
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
72 | |
62 | |
51 | |
48 |
User | Count |
---|---|
206 | |
90 | |
62 | |
59 | |
57 |