The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi Guys,
I want my formula to return a 1 if it is between a specific start and end date. I have specified my start and end date, but whatever I try to get te formula to return a 1 for all the dates in that range I get an error.
Can you please help me.
Thanks in advance.
Menno
Solved! Go to Solution.
Hey,
This is because you didn't formulate 'Today' in your VAR StartDate. Is your StartDate February 1, 2022 and your EndDate November 30, 2022? For that you can use this code:
Trailling 63 =
VAR StartDate =
EOMONTH ( TODAY (), -7 ) + 1
VAR EndDate =
EOMONTH ( StartDate, 9 )
RETURN
CONVERT ( [Date] >= StartDate && [Date] <= EndDate, INTEGER )
Let me know if your start and end dates are different.
Use this below RETURN:
RETURN
IF ( [Date]>= StartDate && [Date] <= EndDate, 1, 0 )
Hi Barthel,
Thanks for your response.
With this formula it returns 1 for every date. It does not take 'today' as a starting point for my calculation.
Hey,
This is because you didn't formulate 'Today' in your VAR StartDate. Is your StartDate February 1, 2022 and your EndDate November 30, 2022? For that you can use this code:
Trailling 63 =
VAR StartDate =
EOMONTH ( TODAY (), -7 ) + 1
VAR EndDate =
EOMONTH ( StartDate, 9 )
RETURN
CONVERT ( [Date] >= StartDate && [Date] <= EndDate, INTEGER )
Let me know if your start and end dates are different.
Thanks! That's what I was looking for.
User | Count |
---|---|
16 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
8 | |
8 |